Skip to content

Commit

Permalink
Merge pull request #145 from CosSalt/master
Browse files Browse the repository at this point in the history
selectTree支持v-tree的所有API
  • Loading branch information
halower committed Nov 25, 2018
2 parents 7b7cd4e + 8eb559e commit 5d93a08
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/components/selectTree.vue
Expand Up @@ -15,19 +15,18 @@
<div class="tree-box" v-show="open">
<input class="search-input" v-model="searchword" v-show="searchable" @keyup.enter="searchNodes" type="text" :placeholder="searchtext">
<v-tree ref='dropTree'
v-bind='vTreeObj'
v-on="$listeners"
:data='data'
:dragAfterExpanded="dragAfterExpanded"
:draggable="draggable"
:tpl ="tpl"
:halfcheck='halfcheck'
:scoped='scoped'
:multiple="multiple"
@dropTreeNodeChecked='nodeCheckStatusChange'
@async-load-nodes='asyncLoadNodes'
@node-expanded='asyncLoadNodes'
@node-click='nodeClick'
@node-check='nodeClick'
@drag-node-end='dragNodeEnd'
/>
</div>
</transition>
Expand All @@ -41,6 +40,7 @@ export default {
model: {
event: 'value-change'
},
inheritAttrs: false,
components: { VTree },
data () {
return {
Expand Down Expand Up @@ -95,17 +95,14 @@ export default {
type: Boolean,
default: true
},
halfcheck: {
type: Boolean,
default: false
},
scoped: {
type: Boolean,
default: false
},
tpl: Function,
searchFilter: Function
},
computed: {
vTreeObj () {
return this.$attrs
}
},
methods: {
/* @event passing the async-load-nodes event to the parent component
* @param node clicked node
Expand All @@ -115,12 +112,6 @@ export default {
this.$emit('async-load-nodes', node)
}
},
/* @event passing the drag-node-end event to the parent component
* @param node clicked node
*/
dragNodeEnd (event) {
this.$emit('drag-node-end', event)
},
/* @event passing the node-click event to the parent component
* @param node clicked node
*/
Expand Down Expand Up @@ -203,6 +194,9 @@ export default {
this.initTreeStatus(node.children)
}
}
},
getTreeRef () {
return this.$refs.dropTree
}
}
}
Expand Down

0 comments on commit 5d93a08

Please sign in to comment.