@netang/quasar 0.1.37 → 0.1.38
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/components/tree/index.vue +19 -5
- package/package.json +1 -1
|
@@ -183,6 +183,9 @@ export default {
|
|
|
183
183
|
|
|
184
184
|
// 【覆盖声明】-------------------------------------------------------
|
|
185
185
|
|
|
186
|
+
// 是否选择的是树节点数据(false:节点键值, true:节点数据)
|
|
187
|
+
selectedNode: Boolean,
|
|
188
|
+
|
|
186
189
|
// 是否开启拖拽
|
|
187
190
|
draggable: Boolean,
|
|
188
191
|
// 是否禁止上下推拽
|
|
@@ -303,6 +306,13 @@ export default {
|
|
|
303
306
|
*/
|
|
304
307
|
const computedControlColor = computed(() => props.controlColor || props.color)
|
|
305
308
|
|
|
309
|
+
/**
|
|
310
|
+
* 当前已选数据键值
|
|
311
|
+
*/
|
|
312
|
+
const currentSelectedKey = computed(function () {
|
|
313
|
+
return props.selectedNode ? props.selected[props.nodeKey] : props.selected
|
|
314
|
+
})
|
|
315
|
+
|
|
306
316
|
/**
|
|
307
317
|
* 文本颜色类名
|
|
308
318
|
*/
|
|
@@ -374,7 +384,7 @@ export default {
|
|
|
374
384
|
children: [],
|
|
375
385
|
matchesFilter: props.filter ? computedFilterMethod.value(node, props.filter) : true,
|
|
376
386
|
|
|
377
|
-
selected: key ===
|
|
387
|
+
selected: key === currentSelectedKey.value && selectable === true,
|
|
378
388
|
selectable,
|
|
379
389
|
expanded: isParent === true ? innerExpanded.value.includes(key) : false,
|
|
380
390
|
expandable,
|
|
@@ -879,10 +889,14 @@ export default {
|
|
|
879
889
|
if (hasSelection.value && meta.selectable) {
|
|
880
890
|
|
|
881
891
|
if (props.noSelectionUnset === false) {
|
|
882
|
-
emit('update:selected', meta.key !==
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
892
|
+
emit('update:selected', meta.key !== currentSelectedKey.value ? (
|
|
893
|
+
props.selectedNode ? node : meta.key
|
|
894
|
+
) : null)
|
|
895
|
+
|
|
896
|
+
} else if (meta.key !== currentSelectedKey.value) {
|
|
897
|
+
emit('update:selected', meta.key === void 0 ? null : (
|
|
898
|
+
props.selectedNode ? node : meta.key
|
|
899
|
+
))
|
|
886
900
|
}
|
|
887
901
|
|
|
888
902
|
} else {
|