sadais-piui 1.2.7-beta24 → 1.2.7-beta25
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.
|
@@ -56,8 +56,12 @@ export default {
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
watch: {
|
|
59
|
-
needInit
|
|
60
|
-
|
|
59
|
+
needInit: {
|
|
60
|
+
deep: true,
|
|
61
|
+
immediate: false,
|
|
62
|
+
handler(value) {
|
|
63
|
+
this.init()
|
|
64
|
+
}
|
|
61
65
|
},
|
|
62
66
|
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
|
|
63
67
|
parentData() {
|
|
@@ -75,9 +79,11 @@ export default {
|
|
|
75
79
|
methods: {
|
|
76
80
|
// 重新初始化一次内部的所有子元素
|
|
77
81
|
init() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
console.log('折叠面板初始化')
|
|
83
|
+
this.children &&
|
|
84
|
+
this.children.map(child => {
|
|
85
|
+
child.init()
|
|
86
|
+
})
|
|
81
87
|
},
|
|
82
88
|
/**
|
|
83
89
|
* collapse-item被点击时触发,由collapse统一处理各子组件的状态
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
name="item"
|
|
46
46
|
:item="item"
|
|
47
47
|
:index="index"
|
|
48
|
-
:length="
|
|
48
|
+
:length="getItemsLength"
|
|
49
49
|
:active="index < val"
|
|
50
50
|
>
|
|
51
51
|
<view>{{ item.name }}</view>
|
|
@@ -250,7 +250,8 @@ export default {
|
|
|
250
250
|
this.direction === 'column' &&
|
|
251
251
|
this.itemsRect.length &&
|
|
252
252
|
this.iconsRect.length &&
|
|
253
|
-
(this.itemsRect.length === 1 || index < this.itemsRect.length - 1)
|
|
253
|
+
(this.itemsRect.length === 1 || index < this.itemsRect.length - 1) &&
|
|
254
|
+
(this.iconsRect.length === 1 || index < this.iconsRect.length - 1)
|
|
254
255
|
) {
|
|
255
256
|
// 动态计算线的位置和高度
|
|
256
257
|
item.lineStyle.top = `${this.iconsRect[index].top -
|
|
@@ -264,6 +265,9 @@ export default {
|
|
|
264
265
|
}
|
|
265
266
|
return item
|
|
266
267
|
})
|
|
268
|
+
},
|
|
269
|
+
getItemsLength() {
|
|
270
|
+
return this.items.length
|
|
267
271
|
}
|
|
268
272
|
},
|
|
269
273
|
watch: {
|
|
@@ -283,7 +287,13 @@ export default {
|
|
|
283
287
|
if (!this.items?.length) return
|
|
284
288
|
this.iconsRect = await this.$pi.common.queryRect(this, '.step-icon-inner', true)
|
|
285
289
|
this.itemsRect = await this.$pi.common.queryRect(this, '.pi-steps-item', true)
|
|
286
|
-
|
|
290
|
+
if (this.iconsRect.length !== this.itemsRect.length) {
|
|
291
|
+
setTimeout(() => {
|
|
292
|
+
this.init()
|
|
293
|
+
}, 200)
|
|
294
|
+
} else {
|
|
295
|
+
console.log(TAG, '计算.pi-steps布局', this.itemsRect, this.iconsRect)
|
|
296
|
+
}
|
|
287
297
|
}
|
|
288
298
|
}
|
|
289
299
|
}
|