This commit is contained in:
梁灏 2017-08-21 18:23:01 +08:00
parent f3893b007d
commit 1183836a92

View file

@ -1,36 +1,48 @@
<template> <template>
<Tree :data="baseData" show-checkbox @on-check-change="handleChange" @on-toggle-expand="showExpand"></Tree> <Tree :data="db" show-checkbox></Tree>
</template> </template>
<script> <script>
export default { export default {
data () { data () {
return { return {
bd: [], db:[
baseData: [
{ {
title: 'parent', title: '父级',
id: '1-0', checked: false,
expand: true,
children: [ children: [
{ {
title: 'child1', title: '孩子',
id: '1-1', checked: false,
expand: true,
children: [ children: [
{ {
title: 'child1-1-1', title: '孙子',
id: '1-1-1' checked: true
}, },
{ {
title: 'child1-1-2', title: '孙子',
id: '1-1-2' checked: false,
children: [
{
title: '曾孙',
checked: false
}
]
} }
] ]
}
]
},
{
title: '其他',
checked: false,
children: [
{
title: '其他孩子',
checked: true
}, },
{ {
title: 'child2', title: '其他孩子2',
id: '1-2', checked: true
children: []
} }
] ]
} }
@ -38,23 +50,10 @@
} }
}, },
methods: { methods: {
handleSelectChange (data) {
console.log(data);
},
updateTree (data) {
data[0].children[0].checked = true;
// data[0].children[0].children[0].checked = true;
// data[0].children[0].children[1].checked = true;
},
handleChange () {
console.log(1)
},
showExpand (payload) {
console.log(payload)
}
}, },
mounted () { mounted () {
this.updateTree(this.baseData);
} }
} }
</script> </script>