@dolphinweex/weex-vue-render 0.2.68 → 0.2.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.common.js +19 -4
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -2679,6 +2679,7 @@ function setRootFont (width, viewportWidth, force) {
|
|
|
2679
2679
|
var rootFontSize = doc.documentElement.style.fontSize;
|
|
2680
2680
|
if (!rootFontSize || force) {
|
|
2681
2681
|
doc.documentElement.style.fontSize = rem + 'px';
|
|
2682
|
+
document.documentElement.style.setProperty('--harmory-density-rootSize', rem);
|
|
2682
2683
|
}
|
|
2683
2684
|
info.rem = rem;
|
|
2684
2685
|
info.rootValue = viewportWidth / 10;
|
|
@@ -2744,6 +2745,7 @@ function init$1 (viewportWidth) {
|
|
|
2744
2745
|
* e.g. ip6 -> get 375 for virtual screen width.
|
|
2745
2746
|
*/
|
|
2746
2747
|
var scale = screenWidth / viewportWidth;
|
|
2748
|
+
document.documentElement.style.setProperty('--harmory-density-scale', scale);
|
|
2747
2749
|
/**
|
|
2748
2750
|
* 1. if set initial/maximum/mimimum-scale some how the page will have a bounce
|
|
2749
2751
|
* effect when user drag the page towards horizontal axis.
|
|
@@ -5112,21 +5114,34 @@ var style = {
|
|
|
5112
5114
|
return weex.utils.px2rem(value + '', rootValue)
|
|
5113
5115
|
}
|
|
5114
5116
|
}
|
|
5117
|
+
// 辅助函数:将kebab-case转换为camelCase
|
|
5118
|
+
const kebabToCamel = (str) => {
|
|
5119
|
+
return str.replace(/-([a-z])/g, (match, letter) => letter.toUpperCase())
|
|
5120
|
+
}
|
|
5121
|
+
|
|
5115
5122
|
if (isPlainObject(value)) {
|
|
5116
5123
|
let cloneObj = this._deepClone(value)
|
|
5124
|
+
let resultObj = {}
|
|
5125
|
+
|
|
5117
5126
|
for (var k in cloneObj) {
|
|
5127
|
+
let camelKey = kebabToCamel(k)
|
|
5128
|
+
let processedValue = cloneObj[k]
|
|
5129
|
+
|
|
5118
5130
|
// 如果是"fontSize", "lineHeight", "letterSpacing"并且值包含wx则按照vp来转化为px使用
|
|
5119
5131
|
if (
|
|
5120
|
-
bindingStyleNamesForPv2Px$1.indexOf(k) > -1 &&typeof
|
|
5121
|
-
|
|
5132
|
+
bindingStyleNamesForPv2Px$1.indexOf(k) > -1 &&typeof processedValue == "string" && processedValue.endsWith('wx')) {
|
|
5133
|
+
processedValue = px2px(processedValue);
|
|
5122
5134
|
}else if (
|
|
5123
5135
|
cloneObj.hasOwnProperty(k)
|
|
5124
5136
|
&& bindingStyleNamesForPx2Rem$1.indexOf(k) > -1
|
|
5125
5137
|
) {
|
|
5126
|
-
|
|
5138
|
+
processedValue = weex.utils.px2rem(processedValue + '', rootValue);
|
|
5127
5139
|
}
|
|
5140
|
+
|
|
5141
|
+
// 使用驼峰命名的key进行赋值,相同的key会被覆盖
|
|
5142
|
+
resultObj[camelKey] = processedValue
|
|
5128
5143
|
}
|
|
5129
|
-
return
|
|
5144
|
+
return resultObj
|
|
5130
5145
|
}
|
|
5131
5146
|
if (isArray(value)) {
|
|
5132
5147
|
let cloneArr = this._deepClone(value)
|
package/package.json
CHANGED