Optimize Tree contextMenu
This commit is contained in:
parent
baa83cac60
commit
e3d2e05598
1 changed files with 12 additions and 9 deletions
|
@ -205,15 +205,18 @@
|
||||||
this.$emit('on-check-change', this.getCheckedNodes(), node);
|
this.$emit('on-check-change', this.getCheckedNodes(), node);
|
||||||
},
|
},
|
||||||
handleContextmenu ({ data, event }) {
|
handleContextmenu ({ data, event }) {
|
||||||
const $TreeWrap = this.$refs.treeWrap;
|
if (this.contextMenuVisible) this.handleClickContextMenuOutside();
|
||||||
const TreeBounding = $TreeWrap.getBoundingClientRect();
|
this.$nextTick(() => {
|
||||||
const position = {
|
const $TreeWrap = this.$refs.treeWrap;
|
||||||
left: `${event.clientX - TreeBounding.left}px`,
|
const TreeBounding = $TreeWrap.getBoundingClientRect();
|
||||||
top: `${event.clientY - TreeBounding.top}px`
|
const position = {
|
||||||
};
|
left: `${event.clientX - TreeBounding.left}px`,
|
||||||
this.contextMenuStyles = position;
|
top: `${event.clientY - TreeBounding.top}px`
|
||||||
this.contextMenuVisible = true;
|
};
|
||||||
this.$emit('on-contextmenu', data, event, position);
|
this.contextMenuStyles = position;
|
||||||
|
this.contextMenuVisible = true;
|
||||||
|
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