From 9d7227885fa48de35a5cc1646cf353d69699a149 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 28 Nov 2023 19:12:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=8F=B0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/frontend/src/components/deDrag/index.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/frontend/src/components/deDrag/index.vue b/core/frontend/src/components/deDrag/index.vue index f005d035a2..70df8c1330 100644 --- a/core/frontend/src/components/deDrag/index.vue +++ b/core/frontend/src/components/deDrag/index.vue @@ -878,12 +878,16 @@ export default { // 获取父元素大小 getParentSize() { if (this.parent === true) { - const style = window.getComputedStyle(this.$el.parentNode, null) - const rect = this.$el.parentNode.getBoundingClientRect() - this.parentX = rect.x - this.parentY = rect.y - // 高度不设置上限100000 宽度增加左右 60px - return [Math.round(parseFloat(style.getPropertyValue('width'), 10)) + 6, 100000] + try { + const style = window.getComputedStyle(this.$el.parentNode, null) + const rect = this.$el.parentNode.getBoundingClientRect() + this.parentX = rect.x + this.parentY = rect.y + // 高度不设置上限100000 宽度增加左右 60px + return [Math.round(parseFloat(style.getPropertyValue('width'), 10)) + 6, 100000] + } catch (e) { + console.warn('custom:getParentSize') + } } if (typeof this.parent === 'string') { const parentNode = document.querySelector(this.parent)