@netang/quasar 0.0.102 → 0.0.103

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.
Files changed (162) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +11 -11
  3. package/_docs/docs/.vuepress/client.js +8 -8
  4. package/_docs/docs/.vuepress/config.js +40 -40
  5. package/_docs/docs/.vuepress/configs/index.js +2 -2
  6. package/_docs/docs/.vuepress/configs/navbar/index.js +1 -1
  7. package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -16
  8. package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -1
  9. package/_docs/docs/.vuepress/configs/sidebar/zh.js +75 -75
  10. package/_docs/docs/.vuepress/public/css/index.css +3 -3
  11. package/_docs/docs/.vuepress/styles/index.scss +3 -3
  12. package/_docs/docs/components/column-title.md +25 -25
  13. package/_docs/docs/components/data.md +66 -66
  14. package/_docs/docs/components/dialog.md +59 -59
  15. package/_docs/docs/components/dragger.md +26 -26
  16. package/_docs/docs/components/editor-code.md +16 -16
  17. package/_docs/docs/components/empty.md +13 -13
  18. package/_docs/docs/components/field-date.md +16 -16
  19. package/_docs/docs/components/field-text.md +57 -57
  20. package/_docs/docs/components/field-tree.md +14 -14
  21. package/_docs/docs/components/img.md +25 -25
  22. package/_docs/docs/components/input-number.md +21 -21
  23. package/_docs/docs/components/list-menu-item.md +21 -21
  24. package/_docs/docs/components/list-menu.md +21 -21
  25. package/_docs/docs/components/power-page.md +21 -21
  26. package/_docs/docs/components/price.md +21 -21
  27. package/_docs/docs/components/render.md +12 -12
  28. package/_docs/docs/components/search-item.md +10 -10
  29. package/_docs/docs/components/search.md +12 -12
  30. package/_docs/docs/components/select.md +11 -11
  31. package/_docs/docs/components/splitter.md +15 -15
  32. package/_docs/docs/components/table-column-fixed.md +20 -20
  33. package/_docs/docs/components/table-pagination.md +20 -20
  34. package/_docs/docs/components/table-splitter.md +20 -20
  35. package/_docs/docs/components/table-summary.md +20 -20
  36. package/_docs/docs/components/table.md +25 -25
  37. package/_docs/docs/components/thumbnail.md +18 -18
  38. package/_docs/docs/components/toolbar.md +9 -9
  39. package/_docs/docs/components/uploader-query.md +19 -19
  40. package/_docs/docs/components/uploader.md +16 -16
  41. package/_docs/docs/components/value-format.md +26 -26
  42. package/_docs/docs/index.md +1 -1
  43. package/_docs/docs/utils/alert.md +26 -26
  44. package/_docs/docs/utils/area.md +112 -112
  45. package/_docs/docs/utils/arr.md +80 -80
  46. package/_docs/docs/utils/auth.md +101 -101
  47. package/_docs/docs/utils/bus.md +18 -18
  48. package/_docs/docs/utils/confirm.md +31 -31
  49. package/_docs/docs/utils/copy.md +22 -22
  50. package/_docs/docs/utils/dialog.md +98 -98
  51. package/_docs/docs/utils/dict.md +50 -50
  52. package/_docs/docs/utils/dictOptions.md +27 -27
  53. package/_docs/docs/utils/form.md +33 -33
  54. package/_docs/docs/utils/getData.md +60 -60
  55. package/_docs/docs/utils/getFile.md +21 -21
  56. package/_docs/docs/utils/getImage.md +33 -33
  57. package/_docs/docs/utils/getTime.md +51 -51
  58. package/_docs/docs/utils/index.md +1 -1
  59. package/_docs/docs/utils/loading.md +18 -18
  60. package/_docs/docs/utils/notify.md +29 -29
  61. package/_docs/docs/utils/power.md +353 -353
  62. package/_docs/docs/utils/previewImage.md +11 -11
  63. package/_docs/docs/utils/price.md +45 -45
  64. package/_docs/docs/utils/rule.md +30 -30
  65. package/_docs/docs/utils/ruleValid.md +31 -31
  66. package/_docs/docs/utils/symbols.md +30 -30
  67. package/_docs/docs/utils/table.md +194 -194
  68. package/_docs/docs/utils/timestamp.md +27 -27
  69. package/_docs/docs/utils/toast.md +27 -27
  70. package/_docs/docs/utils/tree.md +174 -174
  71. package/_docs/docs/utils/uploader.md +29 -29
  72. package/_docs/package.json +11 -11
  73. package/components/column-title/index.vue +37 -37
  74. package/components/data/index.vue +20 -20
  75. package/components/dialog/index.vue +372 -372
  76. package/components/dragger/index.vue +203 -203
  77. package/components/drawer/index.vue +303 -303
  78. package/components/editor-code/index.vue +289 -289
  79. package/components/empty/index.vue +71 -71
  80. package/components/field-date/index.vue +850 -850
  81. package/components/field-date/methods.js +100 -100
  82. package/components/field-table/index.vue +1222 -1222
  83. package/components/field-text/index.vue +165 -165
  84. package/components/field-tree/index.vue +103 -81
  85. package/components/img/index.vue +202 -202
  86. package/components/input-number/index.vue +546 -546
  87. package/components/list-menu/index.vue +149 -149
  88. package/components/list-menu-item/index.vue +79 -79
  89. package/components/power-page/index.vue +92 -92
  90. package/components/price/index.vue +188 -188
  91. package/components/private/components/index.js +11 -11
  92. package/components/private/components/move-to-tree/index.vue +154 -154
  93. package/components/private/edit-power-data/index.vue +816 -816
  94. package/components/private/table-visible-columns-button/index.vue +109 -109
  95. package/components/render/index.vue +150 -150
  96. package/components/search/index.vue +222 -222
  97. package/components/search-item/index.vue +210 -210
  98. package/components/splitter/index.vue +415 -415
  99. package/components/table/index.vue +456 -456
  100. package/components/table-column-fixed/index.vue +112 -112
  101. package/components/table-pagination/index.vue +192 -192
  102. package/components/table-splitter/index.vue +360 -360
  103. package/components/table-summary/index.vue +110 -110
  104. package/components/thumbnail/index.vue +72 -72
  105. package/components/toolbar/container.vue +31 -31
  106. package/components/toolbar/index.vue +136 -136
  107. package/components/uploader/index.vue +158 -158
  108. package/components/uploader-query/index.vue +758 -758
  109. package/components/value-format/index.vue +274 -274
  110. package/configs/area3.js +1 -1
  111. package/docs/css/index.css +3 -3
  112. package/package.json +1 -1
  113. package/sass/common.scss +174 -174
  114. package/sass/index.scss +14 -14
  115. package/sass/line.scss +39 -39
  116. package/sass/quasar/btn.scss +46 -46
  117. package/sass/quasar/common.scss +3 -3
  118. package/sass/quasar/dialog.scss +7 -7
  119. package/sass/quasar/drawer.scss +6 -6
  120. package/sass/quasar/field.scss +243 -243
  121. package/sass/quasar/loading.scss +6 -6
  122. package/sass/quasar/menu.scss +8 -8
  123. package/sass/quasar/table.scss +150 -150
  124. package/sass/quasar/toolbar.scss +22 -22
  125. package/store/index.js +29 -29
  126. package/utils/$auth.js +127 -127
  127. package/utils/$form.js +56 -56
  128. package/utils/$power.js +1215 -1215
  129. package/utils/$rule.js +13 -13
  130. package/utils/$ruleValid.js +10 -10
  131. package/utils/$table.js +999 -999
  132. package/utils/$tree.js +713 -713
  133. package/utils/alert.js +12 -12
  134. package/utils/area.js +400 -400
  135. package/utils/arr.js +51 -51
  136. package/utils/bus.js +6 -6
  137. package/utils/config.js +52 -52
  138. package/utils/confirm.js +11 -11
  139. package/utils/copy.js +30 -30
  140. package/utils/dialog.js +36 -36
  141. package/utils/dict.js +21 -21
  142. package/utils/dictOptions.js +28 -28
  143. package/utils/getData.js +73 -73
  144. package/utils/getFile.js +40 -40
  145. package/utils/getImage.js +153 -153
  146. package/utils/getTime.js +106 -106
  147. package/utils/index.js +61 -61
  148. package/utils/loading.js +15 -15
  149. package/utils/notify.js +13 -13
  150. package/utils/previewImage.js +10 -10
  151. package/utils/price.js +18 -18
  152. package/utils/symbols.js +18 -18
  153. package/utils/timestamp.js +18 -18
  154. package/utils/toast.js +13 -13
  155. package/utils/uploader/aliyun.js +6 -6
  156. package/utils/uploader/local.js +8 -8
  157. package/utils/uploader/qiniu.js +321 -321
  158. package/utils/uploader.js +1059 -1059
  159. package/utils/useAuth.js +30 -30
  160. package/utils/useRouter.js +47 -47
  161. package/utils/useSearch.js +0 -6
  162. package/utils/useUploader.js +53 -53
@@ -1,165 +1,165 @@
1
- <template>
2
- <q-field
3
- class="n-field-fieldset"
4
- :label="label"
5
- :stack-label="stackLabel"
6
- :outlined="outlined"
7
- :dense="dense"
8
- :readonly="readonly"
9
- v-bind="$attrs"
10
- >
11
- <template v-slot:control>
12
-
13
- <!-- 如果有默认插槽 -->
14
- <template v-if="$slots.default">
15
-
16
- <!-- 如果开启复制 -->
17
- <div
18
- class="full-width"
19
- :class="valueClass"
20
- :style="valueStyle"
21
- @click="onCopy"
22
- v-if="! noCopy"
23
- >
24
- <slot
25
- :value="value"
26
- />
27
- </div>
28
-
29
- <!-- 否则仅展示 -->
30
- <div
31
- class="full-width"
32
- :class="valueClass"
33
- :style="valueStyle"
34
- v-else
35
- >
36
- <slot
37
- :value="value"
38
- />
39
- </div>
40
- </template>
41
-
42
- <!-- 否则如果开启复制 -->
43
- <div
44
- class="full-width"
45
- :class="valueClass"
46
- :style="valueStyle"
47
- @click="onCopy"
48
- v-else-if="! noCopy"
49
- >{{value}}</div>
50
-
51
- <!-- 否则仅展示 -->
52
- <div
53
- class="full-width"
54
- :class="valueClass"
55
- :style="valueStyle"
56
- v-else
57
- >{{value}}</div>
58
-
59
- </template>
60
-
61
- <template
62
- v-for="slotName in slotNames"
63
- v-slot:[slotName]
64
- >
65
- <slot
66
- :name="slotName"
67
- :value="value"
68
- />
69
- </template>
70
- </q-field>
71
- </template>
72
-
73
- <script>
74
- import { computed } from 'vue'
75
-
76
- import $n_omit from 'lodash/omit'
77
-
78
- import $n_isValidObject from '@netang/utils/isValidObject'
79
-
80
- import $n_copy from '../../utils/copy'
81
-
82
- export default {
83
-
84
- /**
85
- * 标识
86
- */
87
- name: 'NFieldText',
88
-
89
- /**
90
- * 声明属性
91
- */
92
- props: {
93
- // 标签
94
- label: [Array, String, Number],
95
- // 值
96
- value: [String, Number],
97
- // 复制文字
98
- copyText: [String, Number],
99
- // 标签始终显示在字段上方
100
- stackLabel: {
101
- type: Boolean,
102
- default: true,
103
- },
104
- // 线条
105
- outlined: {
106
- type: Boolean,
107
- default: true,
108
- },
109
- // 紧凑模式
110
- dense: {
111
- type: Boolean,
112
- default: true,
113
- },
114
- // 只读模式
115
- readonly: {
116
- type: Boolean,
117
- default: true,
118
- },
119
- // 禁止复制
120
- noCopy: Boolean,
121
- // 值类名
122
- valueClass: String,
123
- // 值样式
124
- valueStyle: [String, Object, Array],
125
- },
126
-
127
- /**
128
- * 组合式
129
- */
130
- setup(props, { slots }) {
131
-
132
- // ==========【计算属性】==========================================================================================
133
-
134
- /**
135
- * 插槽标识数组
136
- */
137
- const slotNames = computed(function() {
138
- return $n_isValidObject(slots) ? Object.keys($n_omit(slots, [ 'default' ])) : []
139
- })
140
-
141
- // ==========【方法】=============================================================================================
142
-
143
- /**
144
- * 复制
145
- */
146
- function onCopy() {
147
- const val = props.copyText || props.value
148
- if (val) {
149
- $n_copy(val, `复制【${props.label}】成功`)
150
- }
151
- }
152
-
153
- // ==========【返回】=============================================================================================
154
-
155
- return {
156
- // 字段组件传参
157
- // fieldProps,
158
- // 插槽标识数组
159
- slotNames,
160
- // 复制
161
- onCopy,
162
- }
163
- },
164
- }
165
- </script>
1
+ <template>
2
+ <q-field
3
+ class="n-field-fieldset"
4
+ :label="label"
5
+ :stack-label="stackLabel"
6
+ :outlined="outlined"
7
+ :dense="dense"
8
+ :readonly="readonly"
9
+ v-bind="$attrs"
10
+ >
11
+ <template v-slot:control>
12
+
13
+ <!-- 如果有默认插槽 -->
14
+ <template v-if="$slots.default">
15
+
16
+ <!-- 如果开启复制 -->
17
+ <div
18
+ class="full-width"
19
+ :class="valueClass"
20
+ :style="valueStyle"
21
+ @click="onCopy"
22
+ v-if="! noCopy"
23
+ >
24
+ <slot
25
+ :value="value"
26
+ />
27
+ </div>
28
+
29
+ <!-- 否则仅展示 -->
30
+ <div
31
+ class="full-width"
32
+ :class="valueClass"
33
+ :style="valueStyle"
34
+ v-else
35
+ >
36
+ <slot
37
+ :value="value"
38
+ />
39
+ </div>
40
+ </template>
41
+
42
+ <!-- 否则如果开启复制 -->
43
+ <div
44
+ class="full-width"
45
+ :class="valueClass"
46
+ :style="valueStyle"
47
+ @click="onCopy"
48
+ v-else-if="! noCopy"
49
+ >{{value}}</div>
50
+
51
+ <!-- 否则仅展示 -->
52
+ <div
53
+ class="full-width"
54
+ :class="valueClass"
55
+ :style="valueStyle"
56
+ v-else
57
+ >{{value}}</div>
58
+
59
+ </template>
60
+
61
+ <template
62
+ v-for="slotName in slotNames"
63
+ v-slot:[slotName]
64
+ >
65
+ <slot
66
+ :name="slotName"
67
+ :value="value"
68
+ />
69
+ </template>
70
+ </q-field>
71
+ </template>
72
+
73
+ <script>
74
+ import { computed } from 'vue'
75
+
76
+ import $n_omit from 'lodash/omit'
77
+
78
+ import $n_isValidObject from '@netang/utils/isValidObject'
79
+
80
+ import $n_copy from '../../utils/copy'
81
+
82
+ export default {
83
+
84
+ /**
85
+ * 标识
86
+ */
87
+ name: 'NFieldText',
88
+
89
+ /**
90
+ * 声明属性
91
+ */
92
+ props: {
93
+ // 标签
94
+ label: [Array, String, Number],
95
+ // 值
96
+ value: [String, Number],
97
+ // 复制文字
98
+ copyText: [String, Number],
99
+ // 标签始终显示在字段上方
100
+ stackLabel: {
101
+ type: Boolean,
102
+ default: true,
103
+ },
104
+ // 线条
105
+ outlined: {
106
+ type: Boolean,
107
+ default: true,
108
+ },
109
+ // 紧凑模式
110
+ dense: {
111
+ type: Boolean,
112
+ default: true,
113
+ },
114
+ // 只读模式
115
+ readonly: {
116
+ type: Boolean,
117
+ default: true,
118
+ },
119
+ // 禁止复制
120
+ noCopy: Boolean,
121
+ // 值类名
122
+ valueClass: String,
123
+ // 值样式
124
+ valueStyle: [String, Object, Array],
125
+ },
126
+
127
+ /**
128
+ * 组合式
129
+ */
130
+ setup(props, { slots }) {
131
+
132
+ // ==========【计算属性】==========================================================================================
133
+
134
+ /**
135
+ * 插槽标识数组
136
+ */
137
+ const slotNames = computed(function() {
138
+ return $n_isValidObject(slots) ? Object.keys($n_omit(slots, [ 'default' ])) : []
139
+ })
140
+
141
+ // ==========【方法】=============================================================================================
142
+
143
+ /**
144
+ * 复制
145
+ */
146
+ function onCopy() {
147
+ const val = props.copyText || props.value
148
+ if (val) {
149
+ $n_copy(val, `复制【${props.label}】成功`)
150
+ }
151
+ }
152
+
153
+ // ==========【返回】=============================================================================================
154
+
155
+ return {
156
+ // 字段组件传参
157
+ // fieldProps,
158
+ // 插槽标识数组
159
+ slotNames,
160
+ // 复制
161
+ onCopy,
162
+ }
163
+ },
164
+ }
165
+ </script>
@@ -100,7 +100,7 @@
100
100
  :ticked="treeTicked"
101
101
  @update:ticked="emitModelValue"
102
102
  v-model:expanded="treeExpanded"
103
- :tick-strategy="currentTickStrategy"
103
+ :tick-strategy="multiple ? (strict ? 'strict' : 'leaf') : 'none'"
104
104
  :accordion="accordion"
105
105
  v-bind="treeProps"
106
106
  v-if="showTree"
@@ -137,11 +137,11 @@ import $n_uniq from 'lodash/uniq'
137
137
  import $n_concat from 'lodash/concat'
138
138
  import $n_isFunction from 'lodash/isFunction'
139
139
 
140
- import $n_forEach from '@netang/utils/forEach'
141
- import $n_isValidArray from '@netang/utils/isValidArray'
142
140
  import $n_indexOf from '@netang/utils/indexOf'
143
141
  import $n_isRequired from '@netang/utils/isRequired'
142
+ import $n_isValidArray from '@netang/utils/isValidArray'
144
143
  import $n_isValidValue from '@netang/utils/isValidValue'
144
+ import $n_isValidObject from '@netang/utils/isValidObject'
145
145
  import $n_runAsync from '@netang/utils/runAsync'
146
146
 
147
147
  export default {
@@ -161,7 +161,7 @@ export default {
161
161
  },
162
162
  // 树展开节点
163
163
  expanded: Array, // v-model:expanded
164
- // 初始节点数组
164
+ // 节点数组
165
165
  // Array: 初始节点数据数据组
166
166
  // Function: 获取初始节点数据的方法
167
167
  nodes: [ Array, Function ],
@@ -212,7 +212,7 @@ export default {
212
212
  /**
213
213
  * 组合式
214
214
  */
215
- setup(props, { attrs, emit }) {
215
+ setup(props, { emit }) {
216
216
 
217
217
  // ==========【计算属性】=========================================================================================
218
218
 
@@ -251,6 +251,9 @@ export default {
251
251
  // 树节点
252
252
  const treeRef = ref(null)
253
253
 
254
+ // tree all
255
+ const treeAll = ref({})
256
+
254
257
  // 树展开数据
255
258
  const treeExpanded = ref(getExpanded())
256
259
 
@@ -260,19 +263,18 @@ export default {
260
263
  // 当前树节点数据
261
264
  const currentTreeNodes = ref(isDefaultLoadNodes ? [] : props.nodes)
262
265
 
263
- // tree all
264
- let treeAll = getTreeAll()
266
+ // 树节点是否已加载
267
+ let __treeNodesLoaded = false
265
268
 
266
- // ==========【计算属性】=========================================================================================
269
+ // 如果为初始加载树节点树
270
+ if (isDefaultLoadNodes) {
267
271
 
268
- /**
269
- * 当前节点选择策略
270
- */
271
- const currentTickStrategy = computed(function () {
272
- return props.multiple ? (
273
- props.strict ? 'strict' : 'leaf'
274
- ) : 'none'
275
- })
272
+ // 初始加载节点
273
+ defaultLoadNodes()
274
+ .finally()
275
+ }
276
+
277
+ // ==========【计算属性】=========================================================================================
276
278
 
277
279
  /**
278
280
  * 树选择节点数据
@@ -281,16 +283,19 @@ export default {
281
283
 
282
284
  const lists = []
283
285
 
284
- $n_forEach(treeTicked.value, function (treeKey) {
286
+ if ($n_isValidObject(treeAll.value)) {
287
+
288
+ for (const treeKey of treeTicked.value) {
285
289
 
286
- // 获取树选择的节点
287
- if ($n_has(treeAll, treeKey)) {
288
- lists.push({
289
- id: treeKey,
290
- label: treeAll[treeKey][props.showAllLevels ? 'path' : 'label'],
291
- })
290
+ // 获取树选择的节点
291
+ if ($n_has(treeAll.value, treeKey)) {
292
+ lists.push({
293
+ id: treeKey,
294
+ label: treeAll.value[treeKey][props.showAllLevels ? 'path' : 'label'],
295
+ })
296
+ }
292
297
  }
293
- })
298
+ }
294
299
 
295
300
  return lists
296
301
  })
@@ -302,14 +307,6 @@ export default {
302
307
  */
303
308
  watch(() => props.nodes, defaultLoadNodes)
304
309
 
305
- /**
306
- * 监听当前节点数组
307
- */
308
- watch(currentTreeNodes, function () {
309
- // 更新 tree all
310
- treeAll = getTreeAll()
311
- })
312
-
313
310
  /**
314
311
  * 监听声明值
315
312
  */
@@ -343,45 +340,43 @@ export default {
343
340
  // ==========【方法】=============================================================================================
344
341
 
345
342
  /**
346
- * 获取 tree all
343
+ * 获取树子节点
347
344
  */
348
- function getTreeAll() {
345
+ function _getTreeChildren(all, data, pid, pPath) {
346
+ for (const item of data) {
349
347
 
350
- const all = {}
348
+ const label = item[props.labelKey]
351
349
 
352
- if (
353
- // 如果显示树
354
- showTree.value
355
- // 如果当前树节点数据为有效数组
356
- && $n_isValidArray(currentTreeNodes.value)
357
- ) {
358
- // 获取子节点
359
- function getChildren(data, pid, pPath) {
360
- for (const item of data) {
361
-
362
- const label = item[props.labelKey]
363
-
364
- const path = pPath ? (pPath + ' / ' + label) : label
365
-
366
- all[item[props.nodeKey]] = {
367
- id: item[props.nodeKey],
368
- pid,
369
- label,
370
- children: item.children,
371
- path,
372
- }
373
-
374
- // 如果是父节点
375
- if ($n_isValidArray(item.children)) {
376
- getChildren(item.children, item.id, path)
377
- }
378
- }
350
+ const path = pPath ? (pPath + ' / ' + label) : label
351
+
352
+ all[item[props.nodeKey]] = {
353
+ id: item[props.nodeKey],
354
+ pid,
355
+ label,
356
+ children: item.children,
357
+ path,
379
358
  }
380
359
 
381
- getChildren(currentTreeNodes.value, 0, '')
360
+ // 如果是父节点
361
+ if ($n_isValidArray(item.children)) {
362
+ _getTreeChildren(all, item.children, item.id, path)
363
+ }
382
364
  }
365
+ }
366
+
367
+ /**
368
+ * 设置 tree all
369
+ */
370
+ function setTreeAll() {
383
371
 
384
- return all
372
+ const all = {}
373
+
374
+ // 如果当前树节点数据为有效数组
375
+ if ($n_isValidArray(currentTreeNodes.value)) {
376
+ _getTreeChildren(all, currentTreeNodes.value, 0, '')
377
+ }
378
+
379
+ treeAll.value = all
385
380
  }
386
381
 
387
382
  /**
@@ -396,8 +391,10 @@ export default {
396
391
  ! props.multiple
397
392
  // 如果有值
398
393
  && $n_isRequired(props.modelValue)
394
+ // 如果有 tree all
395
+ && $n_isValidObject(treeAll.value)
399
396
  // 存在节点
400
- && $n_has(treeAll, props.modelValue)
397
+ && $n_has(treeAll.value, props.modelValue)
401
398
  ) {
402
399
  // 获取父节点
403
400
  function getParent({ id, pid, children }) {
@@ -409,16 +406,16 @@ export default {
409
406
  }
410
407
 
411
408
  // 如果有父节点, 则继续向上寻找
412
- if (pid && $n_has(treeAll, pid)) {
413
- getParent(treeAll[pid])
409
+ if (pid && $n_has(treeAll.value, pid)) {
410
+ getParent(treeAll.value[pid])
414
411
  }
415
412
  }
416
413
 
417
- getParent(treeAll[props.modelValue])
418
- }
414
+ getParent(treeAll.value[props.modelValue])
419
415
 
420
- if (props.expanded) {
421
- expanded = $n_uniq($n_concat(expanded, props.expanded))
416
+ if (props.expanded) {
417
+ expanded = $n_uniq($n_concat(expanded, props.expanded))
418
+ }
422
419
  }
423
420
 
424
421
  return expanded
@@ -577,7 +574,6 @@ export default {
577
574
  /**
578
575
  * 弹出层显示回调
579
576
  */
580
- let __treeLoaded = false
581
577
  async function onPopupShow() {
582
578
 
583
579
  // 显示弹出层
@@ -588,7 +584,7 @@ export default {
588
584
 
589
585
  if (
590
586
  // 如果树已加载过了
591
- __treeLoaded
587
+ __treeNodesLoaded
592
588
  // 如果树已显示
593
589
  || showTree.value
594
590
  ) {
@@ -644,8 +640,6 @@ export default {
644
640
  */
645
641
  async function defaultLoadNodes() {
646
642
 
647
- let resNodes = props.nodes
648
-
649
643
  // 如果是初始加载树节点树
650
644
  if ($n_isFunction(props.nodes)) {
651
645
 
@@ -655,14 +649,44 @@ export default {
655
649
  // 下次 DOM 更新
656
650
  await nextTick()
657
651
 
658
- resNodes = await $n_runAsync(props.nodes)()
659
- }
652
+ // 通过自定义方法获取树节点数组
653
+ const resNodes = await $n_runAsync(props.nodes)()
654
+
655
+ if ($n_isValidArray(resNodes)) {
660
656
 
661
- // 设置当前树节点数组
662
- currentTreeNodes.value = $n_isValidArray(resNodes) ? resNodes : []
657
+ // 设置当前树节点数组
658
+ currentTreeNodes.value = resNodes
659
+
660
+ // 设置 tree all
661
+ setTreeAll()
662
+
663
+ // 设置开数据
664
+ treeExpanded.value = getExpanded()
665
+
666
+ } else {
667
+
668
+ // 设置当前树节点数组
669
+ currentTreeNodes.value = []
670
+
671
+ // 设置 tree all
672
+ setTreeAll()
673
+ }
674
+
675
+ // 否则为节点数组数据
676
+ } else {
677
+
678
+ // 设置当前树节点数组
679
+ currentTreeNodes.value = $n_isValidArray(props.nodes) ? props.nodes : []
680
+
681
+ // 设置 tree all
682
+ setTreeAll()
683
+ }
663
684
 
664
685
  // 设置显示树
665
686
  showTree.value = true
687
+
688
+ // 树已加载
689
+ __treeNodesLoaded = true
666
690
  }
667
691
 
668
692
  // ==========【生命周期】=========================================================================================
@@ -701,8 +725,6 @@ export default {
701
725
  treeExpanded,
702
726
  // 当前树节点数据
703
727
  currentTreeNodes,
704
- // 当前节点选择策略
705
- currentTickStrategy,
706
728
 
707
729
  // 触发更新值
708
730
  emitModelValue,