vue-tree-jf
v1.0.10
Published
vue-tree
Downloads
41
Readme
v-tree
github地址:https://github.com/jianfeng418/vue-tree
Usage
npm install vue-tree-jf --save
import vueTree from 'vue-tree-jf'
Vue.use(vueTree);
.....
<vue-tree :treeData='datas' ref='vtree' @clickNode ='clickNode' ></vue-tree>
初始化参数
treeData参数
方法
事件说明
使用示例
<template><div class="hello">
<vue-tree :treeData='datas' ref='vtree' @clickNode='clickNode' :checkBox='checkbox'></vue-tree>
<button @click='findSelected'>getNode</button></div>
</template>
<script>
import Vue from 'vue'
import vueTree from 'vue-tree-jf'
Vue.use(vueTree);
export default {
name: 'HelloWorld',
methods:{
findSelected(){
console.log('you clicked' + JSON.stringify(this.$refs.vtree.getSelectedNode()));
if(this.checkbox){
console.log('you choosed ' + JSON.stringify(this.$refs.vtree.getCheckedNodes()))
}
},
clickNode(target){
console.log('you clicked '+ target.id)
}
},
data () {
return {
msg: 'Welcome to Your vtree App',
checkbox:true,
datas:[
{text:'xiaoming',
id:'1',
icon:'folder',
children:[
{text:'1-1',
id:'1-1',
icon:'folder',
children:[
{text:'1-1-1',
id:'1-1-1',
icon:'file',
},{text:'1-1-2',
id:'1-1-2',
icon:'file'
}]
},{
text:'1-2',
id:'1-2',
icon:'file',
}]
},
{text:'hua',
id:'2',
icon:'folder',
children:[{
text:'2-2',
id:'2-2',
icon:'file',
}]
},
{text:'hua',
id:'3',
icon:'folder',
children:[{
text:'3-3',
id:'3-3',
icon:'file',
}]
}
]
}
},
}
</script>
<style scoped>
.hello{
float:left;
width:400px;
border:1px solid black;
}
</style>