@neatui/nuxt 1.6.10 → 1.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neatui/nuxt",
3
- "version": "1.6.10",
3
+ "version": "1.6.11",
4
4
  "description": "NeatUI component library for Nuxt 3",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -4,7 +4,7 @@
4
4
  <button ui-btn="@a s case :border"><i class="icon icon-dropdown"></i></button>
5
5
  </slot>
6
6
  </div>
7
- <Teleport v-if="$slots.tips" to="#ifollow">
7
+ <Teleport v-if="teleportReady && $slots.tips" to="#ifollow">
8
8
  <div
9
9
  ref="tip"
10
10
  :class="`${tipClass}${mobile ? ' fekit-follow-mobile' : ''}`"
@@ -37,15 +37,6 @@
37
37
 
38
38
  const emits = defineEmits(['update:modelValue', 'onhide', 'onshow']);
39
39
 
40
- if (import.meta.client) {
41
- const area = document.querySelector('#ifollow');
42
- if (!area) {
43
- const el = document.createElement('div');
44
- el.id = 'ifollow';
45
- document.body.appendChild(el);
46
- }
47
- }
48
-
49
40
  // 类型
50
41
  interface Props {
51
42
  modelValue?: string | number;
@@ -83,6 +74,7 @@
83
74
  const dom: any = ref(null);
84
75
  const tip: any = ref(null);
85
76
  const box: any = ref(null);
77
+ const teleportReady = ref(false);
86
78
  const state = reactive({
87
79
  view: 0,
88
80
  show: 0,
@@ -173,7 +165,18 @@
173
165
  }
174
166
  };
175
167
 
168
+ const ensureTeleportTarget = () => {
169
+ let area = document.querySelector('#ifollow');
170
+ if (!area) {
171
+ area = document.createElement('div');
172
+ area.id = 'ifollow';
173
+ document.body.appendChild(area);
174
+ }
175
+ teleportReady.value = true;
176
+ };
177
+
176
178
  onMounted(() => {
179
+ ensureTeleportTarget();
177
180
  document.addEventListener('click', cancel, true);
178
181
  // 添加触摸事件监听器以防止页面滚动
179
182
  document.addEventListener('touchstart', preventTouchScroll, { passive: false });