mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-25 11:58:12 +00:00
perf: 优化长按菜单位置
This commit is contained in:
parent
54a42a14b6
commit
77940c9430
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-manage" :class="pageClass">
|
<div class="page-manage" :class="pageClass">
|
||||||
<div class="manage-box-menu">
|
<div ref="boxMenu" class="manage-box-menu">
|
||||||
<Dropdown
|
<Dropdown
|
||||||
class="page-manage-menu-dropdown main-menu"
|
class="page-manage-menu-dropdown main-menu"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
@ -1143,9 +1143,10 @@ export default {
|
|||||||
this.operateItem = $A.isJson(projectItem) ? projectItem : {};
|
this.operateItem = $A.isJson(projectItem) ? projectItem : {};
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
|
const parentRect = this.$refs.boxMenu?.getBoundingClientRect() || {top: 0, left: 0}
|
||||||
this.operateStyles = {
|
this.operateStyles = {
|
||||||
left: `${event.clientX}px`,
|
left: `${event.clientX - parentRect.left}px`,
|
||||||
top: `${rect.top + this.windowScrollY}px`,
|
top: `${rect.top + this.windowScrollY - parentRect.top}px`,
|
||||||
height: rect.height + 'px',
|
height: rect.height + 'px',
|
||||||
}
|
}
|
||||||
this.operateVisible = true;
|
this.operateVisible = true;
|
||||||
|
|||||||
@ -183,9 +183,10 @@ export default {
|
|||||||
this.operateItem = $A.isJson(projectItem) ? projectItem : {};
|
this.operateItem = $A.isJson(projectItem) ? projectItem : {};
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
|
const parentRect = this.$el.getBoundingClientRect() || {top: 0, left: 0}
|
||||||
this.operateStyles = {
|
this.operateStyles = {
|
||||||
left: `${event.clientX}px`,
|
left: `${event.clientX - parentRect.left}px`,
|
||||||
top: `${rect.top + this.windowScrollY}px`,
|
top: `${rect.top + this.windowScrollY - parentRect.top}px`,
|
||||||
height: rect.height + 'px',
|
height: rect.height + 'px',
|
||||||
}
|
}
|
||||||
this.operateVisible = true;
|
this.operateVisible = true;
|
||||||
|
|||||||
@ -1060,9 +1060,10 @@ export default {
|
|||||||
this.operateVisible = false;
|
this.operateVisible = false;
|
||||||
this.operateItem = $A.isJson(item) ? item : {};
|
this.operateItem = $A.isJson(item) ? item : {};
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
const parentRect = this.$refs.list?.$el?.getBoundingClientRect() || {top: 0, left: 0}
|
||||||
this.operateStyles = {
|
this.operateStyles = {
|
||||||
left: `${clientX}px`,
|
left: `${clientX - parentRect.left}px`,
|
||||||
top: `${rect.top + this.windowScrollY}px`,
|
top: `${rect.top + this.windowScrollY - parentRect.top}px`,
|
||||||
height: rect.height + 'px',
|
height: rect.height + 'px',
|
||||||
}
|
}
|
||||||
this.operateVisible = true;
|
this.operateVisible = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user