From 324652b1baebb12d501be2ddbad940b26bbae534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Thu, 27 Mar 2025 18:10:57 +0800 Subject: [PATCH] =?UTF-8?q?Demo=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E5=A4=9A=E4=B8=AA=E5=A4=96=E6=A1=86=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=BF=80=E6=B4=BB=E6=9F=90=E4=B8=AA=E5=A4=96=E6=A1=86=E6=97=B6?= =?UTF-8?q?=E5=A4=96=E6=A1=86=E6=A0=B7=E5=BC=8F=E9=BB=98=E8=AE=A4=E5=9B=9E?= =?UTF-8?q?=E5=A1=AB=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/Edit/components/NodeOuterFrame.vue | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/web/src/pages/Edit/components/NodeOuterFrame.vue b/web/src/pages/Edit/components/NodeOuterFrame.vue index 6c6bb070..c6d842a7 100644 --- a/web/src/pages/Edit/components/NodeOuterFrame.vue +++ b/web/src/pages/Edit/components/NodeOuterFrame.vue @@ -136,6 +136,14 @@ import Color from './Color.vue' import { mapState } from 'vuex' import { lineWidthList, borderDasharrayList } from '@/config' +const defaultStyleConfig = { + radius: 5, + strokeWidth: 2, + strokeColor: '#0984e3', + strokeDasharray: '5,5', + fill: 'rgba(9,132,227,0.05)' +} + export default { components: { Color @@ -155,11 +163,7 @@ export default { top: 0 }, styleConfig: { - radius: 5, - strokeWidth: 2, - strokeColor: '#0984e3', - strokeDasharray: '5,5', - fill: 'rgba(9,132,227,0.05)' + ...defaultStyleConfig } } }, @@ -195,8 +199,12 @@ export default { // 取范围内第一个节点的外框样式 const firstNode = parentNode.children[range[0]] const firstNodeOuterFrame = firstNode.getData('outerFrame') - Object.keys(firstNodeOuterFrame).forEach(key => { - this.styleConfig[key] = firstNodeOuterFrame[key] + Object.keys(this.styleConfig).forEach(key => { + if (typeof firstNodeOuterFrame[key] !== 'undefined') { + this.styleConfig[key] = firstNodeOuterFrame[key] + } else { + this.styleConfig[key] = defaultStyleConfig[key] + } }) // 获取外框的位置大小信息 const { x, y, width } = el.rbox()