mali-applet-ui 1.0.90 → 1.0.91
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.
|
@@ -78,6 +78,7 @@ export default {
|
|
|
78
78
|
props: {
|
|
79
79
|
value: [Array, String, Number],
|
|
80
80
|
check: Boolean,
|
|
81
|
+
autoload: Boolean,
|
|
81
82
|
height: [String, Number],
|
|
82
83
|
multiple: Boolean,
|
|
83
84
|
breadcrumb: Boolean,
|
|
@@ -162,31 +163,44 @@ export default {
|
|
|
162
163
|
return `${height}rpx`
|
|
163
164
|
}
|
|
164
165
|
},
|
|
166
|
+
mounted () {
|
|
167
|
+
const { autoload, reloadLazy } = this
|
|
168
|
+
if (autoload) {
|
|
169
|
+
reloadLazy()
|
|
170
|
+
}
|
|
171
|
+
},
|
|
165
172
|
methods: {
|
|
166
173
|
async handleIntoChildren (item) {
|
|
167
|
-
const {
|
|
168
|
-
if (!(item.children && item.children.length) &&
|
|
174
|
+
const { reloadLazy } = this
|
|
175
|
+
if (!(item.children && item.children.length) && !item.isLeaf) {
|
|
169
176
|
// this.lazyLoading = true
|
|
170
|
-
await
|
|
177
|
+
await reloadLazy(item)
|
|
171
178
|
// this.lazyLoading = false
|
|
172
179
|
}
|
|
173
180
|
if (item.children && item.children.length) {
|
|
174
181
|
this.cache.push(item)
|
|
175
|
-
this.$emit('into',
|
|
182
|
+
this.$emit('into', this.cache[this.cache.length - 1])
|
|
176
183
|
}
|
|
177
184
|
},
|
|
178
|
-
async reloadLazy () {
|
|
179
|
-
const { lazyLoad, lazy,
|
|
185
|
+
async reloadLazy (current) {
|
|
186
|
+
const { lazyLoad, lazy, useProps } = this
|
|
180
187
|
if (lazy && lazyLoad) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
const list = await lazyLoad.call(this.currVM, current)
|
|
189
|
+
if (current) {
|
|
190
|
+
current[useProps.children] = list
|
|
191
|
+
} else {
|
|
192
|
+
this.$emit('update:tree', list)
|
|
193
|
+
}
|
|
184
194
|
}
|
|
185
195
|
},
|
|
186
196
|
handleBack () {
|
|
187
|
-
const { cache
|
|
197
|
+
const { cache } = this
|
|
188
198
|
cache.splice(cache.length - 1, 1)
|
|
189
|
-
|
|
199
|
+
if (cache.length) {
|
|
200
|
+
this.$emit('back', cache[cache.length - 1])
|
|
201
|
+
} else {
|
|
202
|
+
this.$emit('back')
|
|
203
|
+
}
|
|
190
204
|
},
|
|
191
205
|
handleToBreadcrumb (index) {
|
|
192
206
|
const { cache } = this
|