Skip to content

Commit 8989234

Browse files
committed
fix: set isRem false
1 parent ee25daf commit 8989234

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ class Element {
6262
const pluginProps = this.pluginProps
6363
const commonStyle = this.commonStyle
6464
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),
6969
fontSize: `${pluginProps.fontSize || commonStyle.fontSize}px`,
7070
color: pluginProps.color || commonStyle.color,
7171
// backgroundColor: pluginProps.backgroundColor || commonStyle.backgroundColor,

front-end/h5/src/engine-entry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Engine = {
1919
<div style={{ height: '100%', position: 'relative' }}>
2020
{
2121
elements.map((element, index) => {
22-
const style = element.getStyle({ position: 'absolute' })
22+
const style = element.getStyle({ position: 'absolute', isRem: true })
2323
const data = {
2424
style,
2525
props: element.getProps({ mode: 'preview' })

front-end/h5/src/utils/element.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function px2Rem (px) {
3131
* @param {Number} px 元素的某个属性的像素值,比如 height
3232
* @param {Boolean} isToRem 是否将 px 转换为 rem
3333
*/
34-
export function parsePx (px, isRem = true) {
34+
export function parsePx (px, isRem = false) {
3535
if (isRem) return px2Rem(px)
3636
return `${px}px`
3737
}

0 commit comments

Comments
 (0)