@neatui/nuxt 1.0.5 → 1.0.6

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.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "NeatUI component library for Nuxt 3",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -43,8 +43,6 @@
43
43
  import scrollTo from '@fekit/scrollto';
44
44
  import { diff, deepcopy, isArray } from '@fekit/utils';
45
45
 
46
- const isClient = typeof window !== 'undefined';
47
-
48
46
  // 通过枚举值查找枚举名
49
47
  const findEnumName = (enums: any, val: any, join: boolean | string = ' Ι ') => {
50
48
  // 转换核心
@@ -72,7 +70,7 @@
72
70
  const props: any = defineProps({
73
71
  area: {
74
72
  type: Object,
75
- default: () => isClient ? document.body : null
73
+ default: () => import.meta.client ? document.body : null
76
74
  },
77
75
  // 数据
78
76
  data: {
@@ -103,7 +101,7 @@
103
101
  // 对比数据
104
102
  diffs: computed(() => {
105
103
  const cloud = props.data || {};
106
- const local = isClient ? JSON.parse(localStorage.getItem(state.cacheKey) || '{}') : {};
104
+ const local = import.meta.client ? JSON.parse(localStorage.getItem(state.cacheKey) || '{}') : {};
107
105
 
108
106
  const diffs = Object.keys(local).length
109
107
  ? (diff(cloud, local) || []).map((item: any) => {
@@ -164,7 +162,7 @@
164
162
 
165
163
  // 定位字段
166
164
  const fScrollToField = (domId: any) => {
167
- if (!isClient || !props.area) return;
165
+ if (!import.meta.client || !props.area) return;
168
166
 
169
167
  const dom = document.querySelector(domId);
170
168
  if (dom) {
@@ -186,7 +184,7 @@
186
184
 
187
185
  // 使用草稿
188
186
  const fConfirmDrafts = ({ field = '', path = [] }: any = {}) => {
189
- if (!isClient) return;
187
+ if (!import.meta.client) return;
190
188
 
191
189
  const local = JSON.parse(localStorage.getItem(state.cacheKey) || '{}');
192
190
  if (field) {
@@ -227,7 +225,7 @@
227
225
  };
228
226
  // 放弃草稿
229
227
  const fDiscardDrafts = ({ field = '', path = [] }: any = {}) => {
230
- if (!isClient) return;
228
+ if (!import.meta.client) return;
231
229
 
232
230
  const local = JSON.parse(localStorage.getItem(state.cacheKey) || '{}');
233
231
  if (field) {
@@ -320,7 +318,7 @@
320
318
  watch(
321
319
  () => props.data,
322
320
  (edit: any, old: any) => {
323
- if (!isClient) return;
321
+ if (!import.meta.client) return;
324
322
 
325
323
  if (edit === old) {
326
324
  if (state.field) {