Commit 8989234348083bb7ae21ca998605fdcdc7ebbff7

Authored by ly525
1 parent ee25daf1

fix: set isRem false

front-end/h5/src/components/core/models/element.js
... ... @@ -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,
... ...
front-end/h5/src/engine-entry.js
... ... @@ -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' })
... ...
front-end/h5/src/utils/element.js
... ... @@ -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 }
... ...