Commit c532b500634a0089cc91c6247f4dbdf05b86ca48
1 parent
39fa9c6d
fix: use rem for font-size
Showing
2 changed files
with
6 additions
and
5 deletions
back-end/h5-api/views/engine.ejs
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | <head> |
| 4 | 4 | <meta charset="UTF-8"> |
| 5 | 5 | <title>work.html</title> |
| 6 | - <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"> | |
| 6 | + <!-- <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"> --> | |
| 7 | 7 | <meta content="yes" name="apple-mobile-web-app-capable"> |
| 8 | 8 | <meta content="black" name="apple-mobile-web-app-status-bar-style"> |
| 9 | 9 | <meta content="telephone=no" name="format-detection"> |
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | <!-- <script type="text/javascript" src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/flexible.js"></script> --> |
| 13 | 13 | <!-- <link rel="stylesheet" href="/be-static/be-static-luban-h5/engine/engine.css"> --> |
| 14 | 14 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/css/swiper.min.css"> |
| 15 | - <link rel="stylesheet" href="https://meyerweb.com/eric/tools/css/reset/reset.css"> | |
| 15 | + <!-- <link rel="stylesheet" href="https://meyerweb.com/eric/tools/css/reset/reset.css"> --> | |
| 16 | 16 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/js/swiper.min.js"></script> |
| 17 | 17 | <script> |
| 18 | 18 | function setDocFontSize(base) { |
| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | domEle.style.fontSize = w / base * 100 + "px"; |
| 37 | 37 | domEle.dataset.dpr = dpr; |
| 38 | 38 | } |
| 39 | + setDocFontSize(320) | |
| 39 | 40 | </script> |
| 40 | 41 | <script>window.__work = <%- JSON.stringify(work) %></script> |
| 41 | 42 | <script src="/engine-assets/engine.js"></script> |
| ... | ... | @@ -49,8 +50,8 @@ |
| 49 | 50 | } |
| 50 | 51 | </style> |
| 51 | 52 | </head> |
| 52 | - | |
| 53 | -<body onload="setDocFontSize(320)"> | |
| 53 | +<!-- <body onload="setDocFontSize(320)"> --> | |
| 54 | +<body> | |
| 54 | 55 | <div id="app"> |
| 55 | 56 | <button class="swiper-button-next" style="position: fixed;left: 1000px">Next</button> |
| 56 | 57 | <button class="swiper-button-prev" style="position: fixed;left: 1000px">Prev</button> | ... | ... |
front-end/h5/src/components/core/models/element.js
| ... | ... | @@ -66,7 +66,7 @@ class Element { |
| 66 | 66 | left: parsePx(pluginProps.left || commonStyle.left, isRem), |
| 67 | 67 | width: parsePx(pluginProps.width || commonStyle.width, isRem), |
| 68 | 68 | height: parsePx(pluginProps.height || commonStyle.height, isRem), |
| 69 | - fontSize: `${pluginProps.fontSize || commonStyle.fontSize}px`, | |
| 69 | + fontSize: parsePx(pluginProps.fontSize || commonStyle.fontSize, isRem), | |
| 70 | 70 | color: pluginProps.color || commonStyle.color, |
| 71 | 71 | // backgroundColor: pluginProps.backgroundColor || commonStyle.backgroundColor, |
| 72 | 72 | textAlign: pluginProps.textAlign || commonStyle.textAlign, | ... | ... |