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

View file

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