Skip to content

Commit 4d86e95

Browse files
committed
feat(element): add defaultStyle for seperate element;
#!zh: 允许通过defaultStyle 给每个元素设置独立的宽高
1 parent 845dfae commit 4d86e95

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

front-end/h5/src/components/core/models/element.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Element {
3232
* element.pluginProps 和 elementcommonStyle 是引用类型,如果不做 deep_clone 可能会出现意外错误
3333
*/
3434
this.pluginProps = (typeof ele.pluginProps === 'object' && cloneObj({ ...ele.pluginProps, uuid: this.uuid })) || this.getDefaultPluginProps(ele.props || {})
35-
this.commonStyle = (typeof ele.commonStyle === 'object' && cloneObj(ele.commonStyle)) || { ...defaultStyle, zindex: ele.zindex }
35+
this.commonStyle = (typeof ele.commonStyle === 'object' && cloneObj(ele.commonStyle)) || { ...defaultStyle, zindex: ele.zindex, ...ele.defaultStyle }
3636
this.events = []
3737
this.animations = ele.animations || []
3838
}

front-end/h5/src/store/modules/element.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,8 @@ export const mutations = {
3939

4040
switch (type) {
4141
case 'add':
42-
// value.name => pluginName
43-
const { name } = value
4442
const vm = getVM(value.name)
45-
const props = vm.$options.props
46-
value = {
47-
...value,
48-
zindex: len + 1
49-
}
50-
const element = new Element({ name, props })
43+
const element = new Element(vm.$options)
5144
elements.push(element)
5245
break
5346
case 'copy':

0 commit comments

Comments
 (0)