Skip to content

Commit

Permalink
fix review issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cl199793 committed Jul 8, 2019
1 parent 7e226e5 commit 231244f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/cascader-panel/src/cascader-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ const checkNode = el => {
}
};
let loadCount = 0;
export default {
name: 'ElCascaderPanel',
Expand Down Expand Up @@ -111,7 +109,8 @@ export default {
checkedNodePaths: [],
store: [],
menus: [],
activePath: []
activePath: [],
loadCount: 0
};
},
Expand Down Expand Up @@ -298,17 +297,21 @@ export default {
node.loaded = true;
// dispose default value on lazy load mode
if (this.checkedValue && Array.isArray(this.checkedValue)) {
const nodeValue = this.checkedValue.slice(loadCount++).shift();
if (Array.isArray(this.checkedValue)) {
const nodeValue = this.checkedValue[this.loadCount++];
const valueKey = this.config.value;
const leafKey = this.config.leaf;
if (Array.isArray(dataList) && dataList.filter(item => item[valueKey] === nodeValue).length > 0) {
const checkedNode = this.store.getNodeByValue(nodeValue);
this.lazyLoad(checkedNode, () => {
this.handleExpand(checkedNode);
});
if (loadCount === this.checkedValue.length) {
if (!checkedNode.data[leafKey]) {
this.lazyLoad(checkedNode, () => {
this.handleExpand(checkedNode);
});
}
if (this.loadCount === this.checkedValue.length) {
this.$parent.computePresentText();
}
}
Expand Down

0 comments on commit 231244f

Please sign in to comment.