iview/examples/routers/tree.vue

42 lines
1.1 KiB
Vue
Raw Normal View History

<template>
<div>
<Tree :data="baseData" show-checkbox></Tree>
<div @click="c">change</div>
</div>
</template>
<script>
export default {
2017-03-03 10:35:38 +08:00
data () {
2017-02-07 11:34:00 +08:00
return {
2017-03-03 10:35:38 +08:00
baseData: [{
2017-02-07 15:29:53 +08:00
expand: true,
2017-02-07 11:34:00 +08:00
title: 'parent 1',
2017-02-07 15:29:53 +08:00
children: [{
2017-02-07 11:34:00 +08:00
title: 'parent 1-0',
expand: true,
disabled: true,
2017-02-07 15:29:53 +08:00
children: [{
2017-02-07 11:34:00 +08:00
title: 'leaf',
disableCheckbox: true
}, {
title: 'leaf',
}]
}, {
title: 'parent 1-1',
2017-03-03 10:35:38 +08:00
expand: true,
2017-02-07 11:34:00 +08:00
checked: true,
2017-02-07 15:29:53 +08:00
children: [{
2017-03-03 10:35:38 +08:00
title: '<span style="color: red">leaf</span>'
2017-02-07 11:34:00 +08:00
}]
}]
}]
}
},
methods: {
c () {
this.baseData[0].expand = false;
}
2017-02-07 11:34:00 +08:00
}
}
</script>