Tree add new props selectNode & expandNode
This commit is contained in:
parent
9dfb572990
commit
efa895a6ba
2 changed files with 16 additions and 2 deletions
|
@ -12,7 +12,7 @@
|
|||
:indeterminate="data.indeterminate"
|
||||
:disabled="data.disabled || data.disableCheckbox"
|
||||
@click.native.prevent="handleCheck"></Checkbox>
|
||||
<span :class="titleClasses" @click="handleSelect">
|
||||
<span :class="titleClasses" @click="handleClickNode">
|
||||
<Render v-if="data.render" :render="data.render" :data="data" :node="node"></Render>
|
||||
<Render v-else-if="isParentRender" :render="parentRender" :data="data" :node="node"></Render>
|
||||
<template v-else>{{ data.title }}</template>
|
||||
|
@ -201,6 +201,13 @@
|
|||
this.dispatch('Tree', 'toggle-expand', this.data);
|
||||
}
|
||||
},
|
||||
handleClickNode () {
|
||||
if (this.TreeInstance.expandNode) {
|
||||
if (this.showArrow) this.handleExpand();
|
||||
} else if (this.TreeInstance.selectNode) {
|
||||
this.handleSelect();
|
||||
}
|
||||
},
|
||||
handleSelect () {
|
||||
if (this.data.disabled) return;
|
||||
if (this.TreeInstance.showCheckbox && this.TreeInstance.checkDirectly) {
|
||||
|
|
|
@ -72,7 +72,14 @@
|
|||
render: {
|
||||
type: Function
|
||||
},
|
||||
|
||||
selectNode: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
expandNode: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
|
Loading…
Add table
Reference in a new issue