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

This commit is contained in:
wangjiahao 2022-02-23 15:57:26 +08:00
parent 0a9edccc4d
commit 6f9deb1530
2 changed files with 10 additions and 2 deletions

View File

@ -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') {

View File

@ -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') {