Commit 8989234348083bb7ae21ca998605fdcdc7ebbff7
1 parent
ee25daf1
fix: set isRem false
Showing
3 changed files
with
6 additions
and
6 deletions
front-end/h5/src/components/core/models/element.js
| @@ -62,10 +62,10 @@ class Element { | @@ -62,10 +62,10 @@ class Element { | ||
| 62 | const pluginProps = this.pluginProps | 62 | const pluginProps = this.pluginProps |
| 63 | const commonStyle = this.commonStyle | 63 | const commonStyle = this.commonStyle |
| 64 | let style = { | 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 | fontSize: `${pluginProps.fontSize || commonStyle.fontSize}px`, | 69 | fontSize: `${pluginProps.fontSize || commonStyle.fontSize}px`, |
| 70 | color: pluginProps.color || commonStyle.color, | 70 | color: pluginProps.color || commonStyle.color, |
| 71 | // backgroundColor: pluginProps.backgroundColor || commonStyle.backgroundColor, | 71 | // backgroundColor: pluginProps.backgroundColor || commonStyle.backgroundColor, |
front-end/h5/src/engine-entry.js
| @@ -19,7 +19,7 @@ const Engine = { | @@ -19,7 +19,7 @@ const Engine = { | ||
| 19 | <div style={{ height: '100%', position: 'relative' }}> | 19 | <div style={{ height: '100%', position: 'relative' }}> |
| 20 | { | 20 | { |
| 21 | elements.map((element, index) => { | 21 | elements.map((element, index) => { |
| 22 | - const style = element.getStyle({ position: 'absolute' }) | 22 | + const style = element.getStyle({ position: 'absolute', isRem: true }) |
| 23 | const data = { | 23 | const data = { |
| 24 | style, | 24 | style, |
| 25 | props: element.getProps({ mode: 'preview' }) | 25 | props: element.getProps({ mode: 'preview' }) |
front-end/h5/src/utils/element.js
| @@ -31,7 +31,7 @@ function px2Rem (px) { | @@ -31,7 +31,7 @@ function px2Rem (px) { | ||
| 31 | * @param {Number} px 元素的某个属性的像素值,比如 height | 31 | * @param {Number} px 元素的某个属性的像素值,比如 height |
| 32 | * @param {Boolean} isToRem 是否将 px 转换为 rem | 32 | * @param {Boolean} isToRem 是否将 px 转换为 rem |
| 33 | */ | 33 | */ |
| 34 | -export function parsePx (px, isRem = true) { | 34 | +export function parsePx (px, isRem = false) { |
| 35 | if (isRem) return px2Rem(px) | 35 | if (isRem) return px2Rem(px) |
| 36 | return `${px}px` | 36 | return `${px}px` |
| 37 | } | 37 | } |