Skip to content

Commit c52dfe4

Browse files
committed
[dev] selectTree支持v-tree的所有API,增加getTreeRef方法用户获取v-tree的ref
1 parent 5f56845 commit c52dfe4

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

src/components/selectTree.vue

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@
1515
<div class="tree-box" v-show="open">
1616
<input class="search-input" v-model="searchword" v-show="searchable" @keyup.enter="searchNodes" type="text" :placeholder="searchtext">
1717
<v-tree ref='dropTree'
18+
v-bind='vTreeObj'
19+
v-on="$listeners"
1820
:data='data'
1921
:dragAfterExpanded="dragAfterExpanded"
2022
:draggable="draggable"
2123
:tpl ="tpl"
22-
:halfcheck='halfcheck'
23-
:scoped='scoped'
2424
:multiple="multiple"
2525
@dropTreeNodeChecked='nodeCheckStatusChange'
2626
@async-load-nodes='asyncLoadNodes'
2727
@node-expanded='asyncLoadNodes'
2828
@node-click='nodeClick'
2929
@node-check='nodeClick'
30-
@drag-node-end='dragNodeEnd'
3130
/>
3231
</div>
3332
</transition>
@@ -41,6 +40,7 @@ export default {
4140
model: {
4241
event: 'value-change'
4342
},
43+
inheritAttrs: false,
4444
components: { VTree },
4545
data () {
4646
return {
@@ -95,17 +95,14 @@ export default {
9595
type: Boolean,
9696
default: true
9797
},
98-
halfcheck: {
99-
type: Boolean,
100-
default: false
101-
},
102-
scoped: {
103-
type: Boolean,
104-
default: false
105-
},
10698
tpl: Function,
10799
searchFilter: Function
108100
},
101+
computed: {
102+
vTreeObj () {
103+
return this.$attrs
104+
}
105+
},
109106
methods: {
110107
/* @event passing the async-load-nodes event to the parent component
111108
* @param node clicked node
@@ -115,12 +112,6 @@ export default {
115112
this.$emit('async-load-nodes', node)
116113
}
117114
},
118-
/* @event passing the drag-node-end event to the parent component
119-
* @param node clicked node
120-
*/
121-
dragNodeEnd (event) {
122-
this.$emit('drag-node-end', event)
123-
},
124115
/* @event passing the node-click event to the parent component
125116
* @param node clicked node
126117
*/
@@ -203,6 +194,9 @@ export default {
203194
this.initTreeStatus(node.children)
204195
}
205196
}
197+
},
198+
getTreeRef () {
199+
return this.$refs.dropTree
206200
}
207201
}
208202
}

0 commit comments

Comments
 (0)