@neatui/nuxt 1.6.7 → 1.6.8

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.7",
3
+ "version": "1.6.8",
4
4
  "description": "NeatUI component library for Nuxt 3",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -31,7 +31,6 @@
31
31
  </template>
32
32
  <script setup lang="ts">
33
33
  import { onMounted, onBeforeUnmount, ref } from 'vue';
34
- import PullLoad, { Easing } from '@fekit/pullload';
35
34
  const emits = defineEmits(['onpull', 'onload']);
36
35
  const props: any = defineProps({
37
36
  pull: {
@@ -48,42 +47,46 @@
48
47
  },
49
48
  });
50
49
  const root: any = ref(null);
51
- const demo: any = ref(null);
52
- demo.value = new PullLoad({
53
- easing: Easing.easeOut,
54
- friction: 0.3,
55
- triggerDistance: 60,
56
- loadingDistance: 50,
57
- ...(props.pull
58
- ? {
59
- onpull: async () => {
60
- emits('onpull', demo.value);
61
- },
62
- }
63
- : {}),
64
- ...(props.pull
65
- ? {
66
- onload: async () => {
67
- emits('onload', demo.value);
68
- },
69
- }
70
- : {}),
71
- });
50
+ const demo: any = ref({ store: { pull: 0, load: 0 } });
51
+
52
+ if (import.meta.client) {
53
+ const { default: PullLoad, Easing } = await import('@fekit/pullload');
54
+ demo.value = new PullLoad({
55
+ easing: Easing.easeOut,
56
+ friction: 0.3,
57
+ triggerDistance: 60,
58
+ loadingDistance: 50,
59
+ ...(props.pull
60
+ ? {
61
+ onpull: async () => {
62
+ emits('onpull', demo.value);
63
+ },
64
+ }
65
+ : {}),
66
+ ...(props.pull
67
+ ? {
68
+ onload: async () => {
69
+ emits('onload', demo.value);
70
+ },
71
+ }
72
+ : {}),
73
+ });
74
+ }
72
75
 
73
76
  onMounted(() => {
74
77
  if (root.value) {
75
- demo.value?.listen(root.value);
78
+ demo.value?.listen?.(root.value);
76
79
  if (props.pull) {
77
- demo.value?.ispull();
80
+ demo.value?.ispull?.();
78
81
  }
79
82
  }
80
83
  });
81
84
  onBeforeUnmount(() => {
82
- demo.value?.remove();
85
+ demo.value?.remove?.();
83
86
  });
84
87
 
85
88
  const pullload = () => {
86
- demo.value?.ispull();
89
+ demo.value?.ispull?.();
87
90
  };
88
91
 
89
92
  defineExpose({ pullload, ex: () => demo.value });