Commit f40c3020c303192a0194f0bfe653f602e42a3ed3

Authored by ly525
1 parent dcf9c069

fix: generate style with pluginProps and defaultProps

front-end/h5/src/components/core/models/element.js
@@ -38,16 +38,18 @@ class Element { @@ -38,16 +38,18 @@ class Element {
38 } 38 }
39 39
40 getStyle () { 40 getStyle () {
41 - return {  
42 - top: `${this.top}px`,  
43 - left: `${this.left}px`,  
44 - width: `${this.width}px`,  
45 - height: `${this.height}px`,  
46 - fontSize: `${this.fontSize}px`,  
47 - color: this.color,  
48 - backgroundColor: this.backgroundColor,  
49 - textAlign: this.textAlign 41 + const pluginProps = this.pluginProps
  42 + let style = {
  43 + top: `${pluginProps.top || this.top}px`,
  44 + left: `${pluginProps.left || this.left}px`,
  45 + width: `${pluginProps.width || this.width}px`,
  46 + height: `${pluginProps.height || this.height}px`,
  47 + fontSize: `${pluginProps.fontSize || this.fontSize}px`,
  48 + color: pluginProps.color || this.color,
  49 + backgroundColor: pluginProps.backgroundColor || this.backgroundColor,
  50 + textAlign: pluginProps.textAlign || this.textAlign
50 } 51 }
  52 + return style
51 } 53 }
52 54
53 getClass () { 55 getClass () {