Optimize Tree contextMenu
This commit is contained in:
parent
baa83cac60
commit
e3d2e05598
1 changed files with 12 additions and 9 deletions
|
@ -205,6 +205,8 @@
|
||||||
this.$emit('on-check-change', this.getCheckedNodes(), node);
|
this.$emit('on-check-change', this.getCheckedNodes(), node);
|
||||||
},
|
},
|
||||||
handleContextmenu ({ data, event }) {
|
handleContextmenu ({ data, event }) {
|
||||||
|
if (this.contextMenuVisible) this.handleClickContextMenuOutside();
|
||||||
|
this.$nextTick(() => {
|
||||||
const $TreeWrap = this.$refs.treeWrap;
|
const $TreeWrap = this.$refs.treeWrap;
|
||||||
const TreeBounding = $TreeWrap.getBoundingClientRect();
|
const TreeBounding = $TreeWrap.getBoundingClientRect();
|
||||||
const position = {
|
const position = {
|
||||||
|
@ -214,6 +216,7 @@
|
||||||
this.contextMenuStyles = position;
|
this.contextMenuStyles = position;
|
||||||
this.contextMenuVisible = true;
|
this.contextMenuVisible = true;
|
||||||
this.$emit('on-contextmenu', data, event, position);
|
this.$emit('on-contextmenu', data, event, position);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleClickContextMenuOutside () {
|
handleClickContextMenuOutside () {
|
||||||
this.contextMenuVisible = false;
|
this.contextMenuVisible = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue