iview/examples/routers/tree.vue

57 lines
1.8 KiB
Vue
Raw Normal View History

<template>
2017-04-27 13:56:58 +08:00
<Tree :data="baseData" show-checkbox @on-check-change="handleChange" ></Tree>
</template>
<script>
export default {
2017-03-03 10:35:38 +08:00
data () {
2017-02-07 11:34:00 +08:00
return {
2017-03-27 09:49:18 +08:00
bd: [],
2017-03-24 20:50:13 +08:00
baseData: [
{
2017-04-27 13:56:58 +08:00
title: 'parent',
id: '1-0',
2017-02-07 11:34:00 +08:00
expand: true,
2017-04-27 13:56:58 +08:00
children: [
{
title: 'child1',
id: '1-1',
expand: true,
children: [
{
title: 'child1-1-1',
id: '1-1-1'
},
{
title: 'child1-1-2',
id: '1-1-2'
}
]
},
{
title: 'child2',
id: '1-2'
}
]
2017-03-27 14:28:42 +08:00
}
2017-03-24 20:50:13 +08:00
]
2017-02-07 11:34:00 +08:00
}
},
methods: {
2017-03-24 20:50:13 +08:00
handleSelectChange (data) {
console.log(data);
2017-04-27 13:56:58 +08:00
},
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)
}
2017-04-27 13:56:58 +08:00
},
mounted () {
this.updateTree(this.baseData);
2017-02-07 11:34:00 +08:00
}
}
</script>