From 3d2989b2330f85ad1e5a3cedd0dcc6dfeef7e41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Tue, 15 Mar 2022 12:38:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(TagsView/index.vue):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=E8=8E=B7=E5=8F=96=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=AE=9E=E4=BE=8B=E7=9A=84ctx=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/TagsView/index.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 906101a6..808ac097 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -68,6 +68,7 @@ import { ref, watch, onMounted, +ComponentInternalInstance, } from "vue"; import path from "path-browserify"; @@ -88,7 +89,7 @@ import useStore from "@/store"; const { tagsView, permission } = useStore(); -const { ctx } = getCurrentInstance() as any; +const { proxy } = getCurrentInstance() as ComponentInternalInstance; // 获取当前组件实例 const router = useRouter(); const route = useRoute(); @@ -276,8 +277,8 @@ function closeAllTags(view: TagView) { function openMenu(tag: TagView, e: MouseEvent) { const menuMinWidth = 105; - const offsetLeft = ctx.$el.getBoundingClientRect().left; // container margin left - const offsetWidth = ctx.$el.offsetWidth; // container width + const offsetLeft = proxy?.$el.getBoundingClientRect().left; // container margin left + const offsetWidth = proxy?.$el.offsetWidth; // container width const maxLeft = offsetWidth - menuMinWidth; // left boundary const l = e.clientX - offsetLeft + 15; // 15: margin right