提交 6f9deb15 authored 作者: wangjiahao's avatar wangjiahao

refactor: 新建或拖入的组件加上背景设置基本元素

上级 0a9edccc
...@@ -531,7 +531,7 @@ export default { ...@@ -531,7 +531,7 @@ export default {
width: this.computedMainSlotWidth, width: this.computedMainSlotWidth,
height: this.computedMainSlotHeight height: this.computedMainSlotHeight
} }
if (this.element.commonBackground.enable) { if (this.element.commonBackground && this.element.commonBackground.enable) {
if (this.element.commonBackground.backgroundType === 'innerImage') { if (this.element.commonBackground.backgroundType === 'innerImage') {
style['background'] = `url(${this.element.commonBackground.innerImage}) no-repeat` style['background'] = `url(${this.element.commonBackground.innerImage}) no-repeat`
} else if (this.element.commonBackground.backgroundType === 'outerImage') { } else if (this.element.commonBackground.backgroundType === 'outerImage') {
......
...@@ -232,7 +232,11 @@ import SubjectSetting from '../SubjectSetting' ...@@ -232,7 +232,11 @@ import SubjectSetting from '../SubjectSetting'
import bus from '@/utils/bus' import bus from '@/utils/bus'
import Editor from '@/components/canvas/components/Editor/index' import Editor from '@/components/canvas/components/Editor/index'
import { deepCopy, panelInit } from '@/components/canvas/utils/utils' 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 { mapState } from 'vuex'
import { uuid } from 'vue-uuid' import { uuid } from 'vue-uuid'
import Toolbar from '@/components/canvas/components/Toolbar' import Toolbar from '@/components/canvas/components/Toolbar'
...@@ -615,6 +619,8 @@ export default { ...@@ -615,6 +619,8 @@ export default {
this.currentFilterCom.id = newComponentId this.currentFilterCom.id = newComponentId
this.currentFilterCom.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix this.currentFilterCom.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix
this.currentFilterCom.mobileStyle = BASE_MOBILE_STYLE this.currentFilterCom.mobileStyle = BASE_MOBILE_STYLE
this.currentFilterCom.commonBackground || deepCopy(COMMON_BACKGROUND)
if (this.currentWidget.filterDialog) { if (this.currentWidget.filterDialog) {
this.show = false this.show = false
...@@ -643,6 +649,8 @@ export default { ...@@ -643,6 +649,8 @@ export default {
component.id = newComponentId component.id = newComponentId
// 新拖入的组件矩阵状态 和仪表板当前的矩阵状态 保持一致 // 新拖入的组件矩阵状态 和仪表板当前的矩阵状态 保持一致
component.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix component.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix
// 统一设置背景信息
component.commonBackground || deepCopy(COMMON_BACKGROUND)
// 视图统一调整为复制 // 视图统一调整为复制
if (componentInfo.type === 'view') { if (componentInfo.type === 'view') {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论