rebuild Tree component
This commit is contained in:
梁灏 2017-03-24 23:14:10 +08:00
parent 3c145e6ffe
commit 53754a3185
3 changed files with 11 additions and 3 deletions

View file

@ -54,6 +54,10 @@
const nodes = findComponentsDownward(this, 'TreeNode');
return nodes.filter(node => node.data.selected).map(node => node.data);
},
getCheckedNodes () {
const nodes = findComponentsDownward(this, 'TreeNode');
return nodes.filter(node => node.data.checked).map(node => node.data);
},
updateData (isInit = true) {
// init checked status
function reverseChecked(data) {
@ -105,6 +109,9 @@
this.$on('checked', () => {
this.updateData(false);
});
this.$on('on-checked', () => {
this.$emit('on-check-change', this.getCheckedNodes());
});
}
};
</script>