fixed: 级联组件data中value类型非字符串时,筛选时无法选中筛选的项

This commit is contained in:
renxinjie 2019-09-11 15:37:08 +08:00
parent 47c239d110
commit 0da0b883c6

View file

@ -207,7 +207,7 @@
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
let item = arr[i]; let item = arr[i];
item.__label = label ? label + ' / ' + item.label : item.label; item.__label = label ? label + ' / ' + item.label : item.label;
item.__value = value ? value + ',' + item.value : item.value; item.__value = value ? [...value, item.value] : [item.value];
if (item.children && item.children.length) { if (item.children && item.children.length) {
getSelections(item.children, item.__label, item.__value); getSelections(item.children, item.__label, item.__value);
@ -328,7 +328,7 @@
this.query = ''; this.query = '';
this.$refs.input.currentValue = ''; this.$refs.input.currentValue = '';
const oldVal = JSON.stringify(this.currentValue); const oldVal = JSON.stringify(this.currentValue);
this.currentValue = item.value.split(','); this.currentValue = item.value;
// use setTimeout for #4786, can not use nextTick, because @on-find-selected use nextTick // use setTimeout for #4786, can not use nextTick, because @on-find-selected use nextTick
setTimeout(() => { setTimeout(() => {
this.emitValue(this.currentValue, oldVal); this.emitValue(this.currentValue, oldVal);