update Tree demo
This commit is contained in:
parent
0e31618388
commit
6ed0cd7377
1 changed files with 33 additions and 32 deletions
|
@ -1,48 +1,42 @@
|
||||||
<template>
|
<template>
|
||||||
<Tree :data="db" show-checkbox></Tree>
|
<div>
|
||||||
|
<Tree :data="baseData" show-checkbox></Tree>
|
||||||
|
<Button @click="handleAdd">add</Button>
|
||||||
|
<Button @click="handleUpdate">update</Button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
db:[
|
baseData: [
|
||||||
{
|
{
|
||||||
title: '父级',
|
expand: true,
|
||||||
checked: false,
|
title: 'parent 1',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: '孩子',
|
title: 'parent 1-0',
|
||||||
checked: false,
|
expand: true,
|
||||||
|
disabled: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: '孙子',
|
title: 'leaf',
|
||||||
checked: true
|
disableCheckbox: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '孙子',
|
title: 'leaf',
|
||||||
checked: false,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '曾孙',
|
|
||||||
checked: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '其他',
|
|
||||||
checked: false,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '其他孩子',
|
|
||||||
checked: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '其他孩子2',
|
title: 'parent 1-1',
|
||||||
checked: true
|
expand: true,
|
||||||
|
checked: true,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: '<span style="color: red">leaf</span>',
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -50,10 +44,17 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleAdd () {
|
||||||
},
|
this.baseData.push(
|
||||||
mounted () {
|
{
|
||||||
|
title: 'test name',
|
||||||
|
checked: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
handleUpdate () {
|
||||||
|
this.$set(this.baseData[0].children[0], 'disabled', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue