Merge pull request #13667 from KidneyFlower/dev

Tree: fix a bug that caused `showCheckbox` props on `Tree` can not affect their children `tree-node`
pull/14207/head
Zhi Cun 2019-01-24 15:21:37 +08:00 committed by GitHub
commit fc84a66544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -61,6 +61,7 @@
:render-content="renderContent" :render-content="renderContent"
v-for="child in node.childNodes" v-for="child in node.childNodes"
:render-after-expand="renderAfterExpand" :render-after-expand="renderAfterExpand"
:show-checkbox="showCheckbox"
:key="getNodeKey(child)" :key="getNodeKey(child)"
:node="child" :node="child"
@node-expand="handleChildNodeExpand"> @node-expand="handleChildNodeExpand">
@ -94,6 +95,10 @@
renderAfterExpand: { renderAfterExpand: {
type: Boolean, type: Boolean,
default: true default: true
},
showCheckbox: {
type: Boolean,
default: false
} }
}, },
@ -127,7 +132,6 @@
tree: null, tree: null,
expanded: false, expanded: false,
childNodeRendered: false, childNodeRendered: false,
showCheckbox: false,
oldChecked: null, oldChecked: null,
oldIndeterminate: null oldIndeterminate: null
}; };
@ -258,8 +262,6 @@
this.node.updateChildren(); this.node.updateChildren();
}); });
this.showCheckbox = tree.showCheckbox;
if (this.node.expanded) { if (this.node.expanded) {
this.expanded = true; this.expanded = true;
this.childNodeRendered = true; this.childNodeRendered = true;

View File

@ -14,6 +14,7 @@
:node="child" :node="child"
:props="props" :props="props"
:render-after-expand="renderAfterExpand" :render-after-expand="renderAfterExpand"
:show-checkbox="showCheckbox"
:key="getNodeKey(child)" :key="getNodeKey(child)"
:render-content="renderContent" :render-content="renderContent"
@node-expand="handleNodeExpand"> @node-expand="handleNodeExpand">