Commit 8989234 1 parent ee25daf commit 8989234 Copy full SHA for 8989234
File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,10 @@ class Element {
62
62
const pluginProps = this . pluginProps
63
63
const commonStyle = this . commonStyle
64
64
let style = {
65
- top : parsePx ( pluginProps . top || commonStyle . top ) ,
66
- left : parsePx ( pluginProps . left || commonStyle . left ) ,
67
- width : parsePx ( pluginProps . width || commonStyle . width ) ,
68
- height : parsePx ( pluginProps . height || commonStyle . height ) ,
65
+ top : parsePx ( pluginProps . top || commonStyle . top , isRem ) ,
66
+ left : parsePx ( pluginProps . left || commonStyle . left , isRem ) ,
67
+ width : parsePx ( pluginProps . width || commonStyle . width , isRem ) ,
68
+ height : parsePx ( pluginProps . height || commonStyle . height , isRem ) ,
69
69
fontSize : `${ pluginProps . fontSize || commonStyle . fontSize } px` ,
70
70
color : pluginProps . color || commonStyle . color ,
71
71
// backgroundColor: pluginProps.backgroundColor || commonStyle.backgroundColor,
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ const Engine = {
19
19
< div style = { { height : '100%' , position : 'relative' } } >
20
20
{
21
21
elements . map ( ( element , index ) => {
22
- const style = element . getStyle ( { position : 'absolute' } )
22
+ const style = element . getStyle ( { position : 'absolute' , isRem : true } )
23
23
const data = {
24
24
style,
25
25
props : element . getProps ( { mode : 'preview' } )
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ function px2Rem (px) {
31
31
* @param {Number } px 元素的某个属性的像素值,比如 height
32
32
* @param {Boolean } isToRem 是否将 px 转换为 rem
33
33
*/
34
- export function parsePx ( px , isRem = true ) {
34
+ export function parsePx ( px , isRem = false ) {
35
35
if ( isRem ) return px2Rem ( px )
36
36
return `${ px } px`
37
37
}
You can’t perform that action at this time.
0 commit comments