Tree add check-directly prop
This commit is contained in:
parent
98221c87b6
commit
467e2cf9a4
3 changed files with 21 additions and 211 deletions
|
@ -41,6 +41,7 @@
|
|||
export default {
|
||||
name: 'TreeNode',
|
||||
mixins: [ Emitter ],
|
||||
inject: ['TreeInstance'],
|
||||
components: { Checkbox, Icon, CollapseTransition, Render },
|
||||
props: {
|
||||
data: {
|
||||
|
@ -156,7 +157,11 @@
|
|||
},
|
||||
handleSelect () {
|
||||
if (this.data.disabled) return;
|
||||
this.dispatch('Tree', 'on-selected', this.data.nodeKey);
|
||||
if (this.TreeInstance.showCheckbox && this.TreeInstance.checkDirectly) {
|
||||
this.handleCheck();
|
||||
} else {
|
||||
this.dispatch('Tree', 'on-selected', this.data.nodeKey);
|
||||
}
|
||||
},
|
||||
handleCheck () {
|
||||
if (this.data.disabled) return;
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
name: 'Tree',
|
||||
mixins: [ Emitter, Locale ],
|
||||
components: { TreeNode },
|
||||
provide () {
|
||||
return { TreeInstance: this };
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
|
@ -38,9 +41,14 @@
|
|||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
checkStrictly:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
checkStrictly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 当开启 showCheckbox 时,如果开启 checkDirectly,select 将强制转为 check 事件
|
||||
checkDirectly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
emptyText: {
|
||||
type: String
|
||||
|
@ -54,7 +62,8 @@
|
|||
},
|
||||
render: {
|
||||
type: Function
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue