fix error log for cascader-panel

pull/21832/head
cgl14207 2022-04-25 22:24:24 +08:00
parent 2f4f6962c6
commit 032b87bbd5
1 changed files with 18 additions and 16 deletions

View File

@ -270,25 +270,27 @@ export default {
} }
}, },
handleExpand(node, silent) { handleExpand(node, silent) {
const { activePath } = this; if (node) {
const { level } = node; const { activePath } = this;
const path = activePath.slice(0, level - 1); const { level } = node;
const menus = this.menus.slice(0, level); const path = activePath.slice(0, level - 1);
const menus = this.menus.slice(0, level);
if (!node.isLeaf) { if (!node.isLeaf) {
path.push(node); path.push(node);
menus.push(node.children); menus.push(node.children);
} }
this.activePath = path; this.activePath = path;
this.menus = menus; this.menus = menus;
if (!silent) { if (!silent) {
const pathValues = path.map(node => node.getValue()); const pathValues = path.map(node => node.getValue());
const activePathValues = activePath.map(node => node.getValue()); const activePathValues = activePath.map(node => node.getValue());
if (!valueEquals(pathValues, activePathValues)) { if (!valueEquals(pathValues, activePathValues)) {
this.$emit('active-item-change', pathValues); // Deprecated this.$emit('active-item-change', pathValues); // Deprecated
this.$emit('expand-change', pathValues); this.$emit('expand-change', pathValues);
}
} }
} }
}, },