Skip to content

Commit f40c302

Browse files
committed
fix: generate style with pluginProps and defaultProps
1 parent dcf9c06 commit f40c302

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

+11-9
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ class Element {
3838
}
3939

4040
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
5051
}
52+
return style
5153
}
5254

5355
getClass () {

0 commit comments

Comments
 (0)