Optimize Table contextMenu
This commit is contained in:
parent
6f7dc71800
commit
baa83cac60
1 changed files with 16 additions and 13 deletions
|
@ -717,19 +717,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
contextmenuCurrentRow (_index, rowKey, event) {
|
contextmenuCurrentRow (_index, rowKey, event) {
|
||||||
const $TableWrap = this.$refs.tableWrap;
|
if (this.contextMenuVisible) this.handleClickContextMenuOutside();
|
||||||
const TableBounding = $TableWrap.getBoundingClientRect();
|
this.$nextTick(() => {
|
||||||
const position = {
|
const $TableWrap = this.$refs.tableWrap;
|
||||||
left: `${event.clientX - TableBounding.left}px`,
|
const TableBounding = $TableWrap.getBoundingClientRect();
|
||||||
top: `${event.clientY - TableBounding.top}px`
|
const position = {
|
||||||
};
|
left: `${event.clientX - TableBounding.left}px`,
|
||||||
this.contextMenuStyles = position;
|
top: `${event.clientY - TableBounding.top}px`
|
||||||
this.contextMenuVisible = true;
|
};
|
||||||
if (rowKey) {
|
this.contextMenuStyles = position;
|
||||||
this.$emit('on-contextmenu', JSON.parse(JSON.stringify(this.getBaseDataByRowKey(rowKey))), event, position);
|
this.contextMenuVisible = true;
|
||||||
} else {
|
if (rowKey) {
|
||||||
this.$emit('on-contextmenu', JSON.parse(JSON.stringify(this.cloneData[_index])), event, position);
|
this.$emit('on-contextmenu', JSON.parse(JSON.stringify(this.getBaseDataByRowKey(rowKey))), event, position);
|
||||||
}
|
} else {
|
||||||
|
this.$emit('on-contextmenu', JSON.parse(JSON.stringify(this.cloneData[_index])), event, position);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getSelection () {
|
getSelection () {
|
||||||
// 分别拿根数据和子数据的已选项
|
// 分别拿根数据和子数据的已选项
|
||||||
|
|
Loading…
Add table
Reference in a new issue