Explorar el Código

feat:优化Empty组件

qianxinyu hace 4 meses
padre
commit
4faa32a645
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      components/Empty/Empty.vue

+ 4 - 2
components/Empty/Empty.vue

@@ -5,7 +5,9 @@
 </template>
 
 <script setup>
-import { ref, onMounted, computed, nextTick } from "vue";
+import { ref, onMounted, computed, nextTick, getCurrentInstance } from "vue";
+
+const { ctx } = getCurrentInstance();
 
 const props = defineProps({
   text: {
@@ -22,7 +24,7 @@ const containerHeight = computed(() => {
 });
 
 const getElementTopDistance = () => {
-  const query = uni.createSelectorQuery();
+  const query = uni.createSelectorQuery().in(ctx);
   query
     .select(".empty-container")
     .boundingClientRect((data) => {