This commit is contained in:
梁灏 2017-08-08 17:19:03 +08:00
parent 6da6fffa1d
commit daa9827c92
3 changed files with 114 additions and 106 deletions

View file

@ -15,7 +15,7 @@
<script>
import Casitem from './casitem.vue';
import Emitter from '../../mixins/emitter';
import { findComponentUpward } from '../../utils/assist';
import { findComponentUpward, findComponentDownward } from '../../utils/assist';
let key = 1;
@ -84,6 +84,14 @@
changeOnSelect: this.changeOnSelect,
fromInit: fromInit
});
// #1553
if (this.changeOnSelect) {
const Caspanel = findComponentDownward(this, 'Caspanel');
if (Caspanel) {
Caspanel.$emit('on-clear', true);
}
}
} else {
this.sublist = [];
this.dispatch('Cascader', 'on-result-change', {
@ -135,9 +143,16 @@
}
}
});
this.$on('on-clear', () => {
// deep for #1553
this.$on('on-clear', (deep = false) => {
this.sublist = [];
this.tmpItem = {};
if (deep) {
const Caspanel = findComponentDownward(this, 'Caspanel');
if (Caspanel) {
Caspanel.$emit('on-clear', true);
}
}
});
}
};