This commit is contained in:
prefert 2020-09-03 15:53:31 +08:00
parent 8f9d3604e6
commit 5bb83ff8e5
258 changed files with 12974 additions and 7838 deletions

View file

@ -1,10 +1,10 @@
<template>
<div>
<Tree ref="treeRef" :data="data4" show-checkbox multiple></Tree>
<Button @click="get">
get
</Button>
</div>
<Tree :data="data4" show-checkbox multiple @on-contextmenu="handleContextMenu">
<template slot="contextMenu">
<DropdownItem @click.native="handleContextMenuEdit">编辑</DropdownItem>
<DropdownItem @click.native="handleContextMenuDelete" style="color: #ed4014">删除</DropdownItem>
</template>
</Tree>
</template>
<script>
export default {
@ -14,14 +14,17 @@
{
title: 'parent 1',
expand: true,
selected: true,
contextmenu: true,
children: [
{
title: 'parent 1-1',
expand: true,
disabled: true,
contextmenu: true,
children: [
{
title: 'leaf 1-1-1',
checked : false,
disabled: true
},
{
@ -32,23 +35,33 @@
{
title: 'parent 1-2',
expand: true,
contextmenu: true,
children: [
{
title: 'leaf 1-2-1',
checked: true
},
{
title: 'leaf 1-2-1'
title: 'leaf 1-2-1',
contextmenu: true,
}
]
}
]
}
]
],
contextTitle: 0
}
},
methods: {
get(){
console.log(this.$refs.treeRef.getCheckedNodes())
handleContextMenu (data) {
this.contextTitle = data.title;
},
handleContextMenuEdit () {
this.$Message.info('Click edit of line' + this.contextTitle);
},
handleContextMenuDelete () {
this.$Message.info('Click delete of line' + this.contextTitle);
}
}
}