fixed #2793
This commit is contained in:
parent
a73ae72b35
commit
5dc44ccf9b
2 changed files with 16 additions and 13 deletions
|
@ -1,11 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<Cascader v-model="value3" :data="data" filterable @on-change="hc"></Cascader>
|
<div style="margin: 100px;width: 300px;">
|
||||||
|
<Cascader v-model="value" :data="data" change-on-select></Cascader>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
data: [{
|
value: ['beijing', 'gugong'],
|
||||||
|
data: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.data = [{
|
||||||
value: 'beijing',
|
value: 'beijing',
|
||||||
label: '北京',
|
label: '北京',
|
||||||
children: [
|
children: [
|
||||||
|
@ -51,14 +59,8 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}],
|
}];
|
||||||
value3: []
|
}, 100)
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
hc (a,b) {
|
|
||||||
console.log(a,b)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -258,8 +258,9 @@
|
||||||
updateResult (result) {
|
updateResult (result) {
|
||||||
this.tmpSelected = result;
|
this.tmpSelected = result;
|
||||||
},
|
},
|
||||||
updateSelected (init = false) {
|
updateSelected (init = false, changeOnSelectDataChange = false) {
|
||||||
if (!this.changeOnSelect || init) {
|
// #2793 changeOnSelectDataChange used for changeOnSelect when data changed and set value
|
||||||
|
if (!this.changeOnSelect || init || changeOnSelectDataChange) {
|
||||||
this.broadcast('Caspanel', 'on-find-selected', {
|
this.broadcast('Caspanel', 'on-find-selected', {
|
||||||
value: this.currentValue
|
value: this.currentValue
|
||||||
});
|
});
|
||||||
|
@ -386,7 +387,7 @@
|
||||||
if (validDataStr !== this.validDataStr) {
|
if (validDataStr !== this.validDataStr) {
|
||||||
this.validDataStr = validDataStr;
|
this.validDataStr = validDataStr;
|
||||||
if (!this.isLoadedChildren) {
|
if (!this.isLoadedChildren) {
|
||||||
this.$nextTick(() => this.updateSelected());
|
this.$nextTick(() => this.updateSelected(false, this.changeOnSelect));
|
||||||
}
|
}
|
||||||
this.isLoadedChildren = false;
|
this.isLoadedChildren = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue