diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 307613ee69..115965c69e 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -531,7 +531,7 @@ export default { width: this.computedMainSlotWidth, height: this.computedMainSlotHeight } - if (this.element.commonBackground.enable) { + if (this.element.commonBackground && this.element.commonBackground.enable) { if (this.element.commonBackground.backgroundType === 'innerImage') { style['background'] = `url(${this.element.commonBackground.innerImage}) no-repeat` } else if (this.element.commonBackground.backgroundType === 'outerImage') { diff --git a/frontend/src/views/panel/edit/index.vue b/frontend/src/views/panel/edit/index.vue index bba738616c..19ebf68fa4 100644 --- a/frontend/src/views/panel/edit/index.vue +++ b/frontend/src/views/panel/edit/index.vue @@ -232,7 +232,11 @@ import SubjectSetting from '../SubjectSetting' import bus from '@/utils/bus' import Editor from '@/components/canvas/components/Editor/index' import { deepCopy, panelInit } from '@/components/canvas/utils/utils' -import componentList, { BASE_MOBILE_STYLE, HYPERLINKS } from '@/components/canvas/custom-component/component-list' // 左侧列表数据 +import componentList, { + BASE_MOBILE_STYLE, + COMMON_BACKGROUND, + HYPERLINKS +} from '@/components/canvas/custom-component/component-list' // 左侧列表数据 import { mapState } from 'vuex' import { uuid } from 'vue-uuid' import Toolbar from '@/components/canvas/components/Toolbar' @@ -615,6 +619,8 @@ export default { this.currentFilterCom.id = newComponentId this.currentFilterCom.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix this.currentFilterCom.mobileStyle = BASE_MOBILE_STYLE + this.currentFilterCom.commonBackground || deepCopy(COMMON_BACKGROUND) + if (this.currentWidget.filterDialog) { this.show = false @@ -643,6 +649,8 @@ export default { component.id = newComponentId // 新拖入的组件矩阵状态 和仪表板当前的矩阵状态 保持一致 component.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix + // 统一设置背景信息 + component.commonBackground || deepCopy(COMMON_BACKGROUND) // 视图统一调整为复制 if (componentInfo.type === 'view') {