@dolphinweex/weex-vue-render 0.2.67 → 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.
@@ -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 cloneObj[k] == "string" && cloneObj[k].endsWith('wx')) {
5121
- cloneObj[k] = px2px(cloneObj[k]);
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
- cloneObj[k] = weex.utils.px2rem(cloneObj[k] + '', rootValue);
5138
+ processedValue = weex.utils.px2rem(processedValue + '', rootValue);
5127
5139
  }
5140
+
5141
+ // 使用驼峰命名的key进行赋值,相同的key会被覆盖
5142
+ resultObj[camelKey] = processedValue
5128
5143
  }
5129
- return cloneObj
5144
+ return resultObj
5130
5145
  }
5131
5146
  if (isArray(value)) {
5132
5147
  let cloneArr = this._deepClone(value)
@@ -5820,17 +5835,40 @@ function getImage(weex) {
5820
5835
  }
5821
5836
  return url
5822
5837
  },
5838
+
5839
+ harmonyTouchStart(event){
5840
+ if (this.$listeners && this.$listeners.harmony_touchstart) {
5841
+ setTimeout(() => {
5842
+ this.$listeners.harmony_touchstart(event)
5843
+ }, 0);
5844
+ }
5845
+ },
5846
+ harmonyTouchMove(event){
5847
+ if (this.$listeners && this.$listeners.harmony_touchmove) {
5848
+ setTimeout(() => {
5849
+ this.$listeners.harmony_touchmove(event)
5850
+ }, 0);
5851
+ }
5852
+ },
5853
+ harmonyTouchEnd(event){
5854
+ if (this.$listeners && this.$listeners.harmony_touchend) {
5855
+ setTimeout(() => {
5856
+ this.$listeners.harmony_touchend(event)
5857
+ }, 0);
5858
+ }
5859
+ },
5823
5860
  },
5824
5861
 
5825
5862
  render: function render(createElement) {
5826
5863
  return createElement("figure", {
5827
5864
  attrs: {
5828
- ...this.$attrs,
5829
5865
  "weex-type": "img",
5830
5866
  src: this.checkTrim(this.src),
5831
5867
  },
5832
5868
  on: {
5833
- ...this.$listeners,
5869
+ harmony_touchstart: this.harmonyTouchStart,
5870
+ harmony_touchmove: this.harmonyTouchMove,
5871
+ harmony_touchend: this.harmonyTouchEnd,
5834
5872
  weex$tap: this.handleClick,
5835
5873
  },
5836
5874
  staticClass: "weex-image weex-el",
@@ -7970,12 +8008,15 @@ var slideMixin = {
7970
8008
  }
7971
8009
  },
7972
8010
  _getWrapperSize: function _getWrapperSize () {
7973
- var wrapper = this.$refs.wrapper;
7974
- if (wrapper) {
7975
- var rect = wrapper.getBoundingClientRect();
7976
- this._wrapperWidth = rect.width;
7977
- this._wrapperHeight = rect.height;
7978
- this.maxHeight = react.height;
8011
+ try{
8012
+ var wrapper = this.$refs.wrapper;
8013
+ if (wrapper) {
8014
+ var rect = wrapper.getBoundingClientRect();
8015
+ this._wrapperWidth = rect.width;
8016
+ this._wrapperHeight = rect.height;
8017
+ this.maxHeight = react.height;
8018
+ }
8019
+ }catch(e){
7979
8020
  }
7980
8021
  },
7981
8022
 
package/package.json CHANGED
@@ -49,5 +49,5 @@
49
49
  "type": "git",
50
50
  "url": "git+ssh://git@github.com/weexteam/weex-vue-render.git"
51
51
  },
52
- "version": "0.2.67"
52
+ "version": "0.2.69"
53
53
  }