update Tree

This commit is contained in:
梁灏 2017-03-24 21:06:49 +08:00
parent cb84e64aab
commit 3c145e6ffe
2 changed files with 19 additions and 16 deletions

View file

@ -66,7 +66,7 @@
classes () {
return [
`${prefixCls}-children`
]
];
},
selectedCls () {
return [
@ -112,7 +112,13 @@
},
handleCheck () {
if (this.disabled) return;
this.data.checked = !this.data.checked;
const checked = !this.data.checked;
if (!checked || this.indeterminate) {
findComponentsDownward(this, 'TreeNode').forEach(node => node.data.checked = false);
} else {
findComponentsDownward(this, 'TreeNode').forEach(node => node.data.checked = true);
}
this.data.checked = checked;
this.dispatch('Tree', 'checked');
},
setIndeterminate () {
@ -126,7 +132,7 @@
mounted () {
this.$on('indeterminate', () => {
this.setIndeterminate();
})
});
}
};
</script>