sadais-piui 1.2.7-beta47 → 1.2.7-beta48
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.
|
@@ -64,10 +64,22 @@
|
|
|
64
64
|
>
|
|
65
65
|
<view class="pi-flex-sub pi-lh-36">
|
|
66
66
|
<slot name="item" :item="item">
|
|
67
|
+
<pi-checkbox
|
|
68
|
+
v-if="parentCanSelect"
|
|
69
|
+
:value="selectedIds.includes(item[keyField])"
|
|
70
|
+
shape="round"
|
|
71
|
+
active-mode="fill-circle"
|
|
72
|
+
class="pi-mg-right-16"
|
|
73
|
+
@click.stop="handleChangeParentSelect(item)"
|
|
74
|
+
/>
|
|
67
75
|
{{ item[displayField] || '' }}
|
|
68
76
|
</slot>
|
|
69
77
|
</view>
|
|
70
|
-
<pi-icon
|
|
78
|
+
<pi-icon
|
|
79
|
+
v-if="!parentCanSelect && selectedIds.includes(item[keyField])"
|
|
80
|
+
name="blod-check"
|
|
81
|
+
size="36"
|
|
82
|
+
/>
|
|
71
83
|
<pi-icon v-if="item[childrenField] && item[childrenField].length > 0" name="right" />
|
|
72
84
|
</view>
|
|
73
85
|
</scroll-view>
|
|
@@ -156,6 +168,12 @@ export default {
|
|
|
156
168
|
// 'children'
|
|
157
169
|
default: cascader.childrenField
|
|
158
170
|
},
|
|
171
|
+
// 父节点是否可选(默认:'false')
|
|
172
|
+
parentCanSelect: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
// false
|
|
175
|
+
default: cascader.parentCanSelect
|
|
176
|
+
},
|
|
159
177
|
// 弹窗选择参数设置
|
|
160
178
|
popupSelect: {
|
|
161
179
|
type: Object,
|
|
@@ -384,6 +402,14 @@ export default {
|
|
|
384
402
|
this.$emit('close')
|
|
385
403
|
this.handleEmitChange()
|
|
386
404
|
},
|
|
405
|
+
handleChangeParentSelect(item, selected) {
|
|
406
|
+
if (this.selectedIds.includes(item[this.keyField])) {
|
|
407
|
+
this.handleRemoveItem(item[this.keyField])
|
|
408
|
+
} else {
|
|
409
|
+
// 选中
|
|
410
|
+
this.selectedIds.push(item[this.keyField])
|
|
411
|
+
}
|
|
412
|
+
},
|
|
387
413
|
/**
|
|
388
414
|
* @vuese
|
|
389
415
|
* 根据id获取item
|
package/config/cascader.js
CHANGED
|
@@ -11,6 +11,7 @@ export default {
|
|
|
11
11
|
itemHeight: 110, // 行高(默认:'110rpx')
|
|
12
12
|
showItemBottomBorder: false, // 是否显示item下边框(默认:'true')
|
|
13
13
|
itemStyle: {}, // 行样式(默认:'{}')
|
|
14
|
+
parentCanSelect: false, // 父节点是否可选(默认:'false')
|
|
14
15
|
popupSelect: popupSelect, // popupSelect配置
|
|
15
16
|
popup: popupSelect.popup, // 弹窗的配置,默认选项请参照popup
|
|
16
17
|
confirmBtn: popupSelect.confirmBtn, // 确认按钮配置
|