@dolphinweex/weex-vue-render 0.1.7 → 0.1.8

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.
@@ -8,9 +8,12 @@ console.log('START WEEX VUE RENDER: 1.0.36, Build 2018-12-29 17:52.');
8
8
  (global.WeexVueRender = factory());
9
9
  }(this, (function () { 'use strict';
10
10
 
11
- function isAbsoluteOrFixedPositioned(element) {
11
+ function isAbsoluteOrFixedPositioned(element, deep=2) {
12
12
  let currentElement = element;
13
- while (currentElement) {
13
+
14
+ let deep_ = 0;
15
+ while (currentElement && deep_ <= deep) {
16
+ deep_++;
14
17
  const position = window.getComputedStyle(currentElement).position;
15
18
  if (position === 'absolute' || position === 'fixed') {
16
19
  return true;
@@ -4839,9 +4842,27 @@ var bindingStyleNamesForPx2Rem$1 = config.bindingStyleNamesForPx2Rem;
4839
4842
 
4840
4843
  var style = {
4841
4844
  methods: {
4845
+ _deepClone: function(obj) {
4846
+ if (typeof obj !== 'object') {
4847
+ return obj; // 基本类型直接返回
4848
+ }
4849
+ if (Array.isArray(obj)) {
4850
+ const arrCopy = [];
4851
+ for (let i = 0; i < obj.length; i++) {
4852
+ arrCopy[i] = this._deepClone(obj[i]);
4853
+ }
4854
+ return arrCopy;
4855
+ }
4856
+ const objCopy = {};
4857
+ for (const key in obj) {
4858
+ if (obj.hasOwnProperty(key)) {
4859
+ objCopy[key] = this._deepClone(obj[key]);
4860
+ }
4861
+ }
4862
+ return objCopy;
4863
+ },
4842
4864
  _px2rem: function _px2rem (value, rootValue) {
4843
4865
  var this$1 = this;
4844
-
4845
4866
  if (typeof value === 'string') {
4846
4867
  return (value + '').replace(/[+-]?\d+(?:.\d*)?[pw]x/gi, function ($0) {
4847
4868
  return weex.utils.px2rem($0, rootValue)
@@ -4851,21 +4872,23 @@ var style = {
4851
4872
  return weex.utils.px2rem(value + '', rootValue)
4852
4873
  }
4853
4874
  if (isPlainObject(value)) {
4854
- for (var k in value) {
4875
+ let cloneObj = this._deepClone(value)
4876
+ for (var k in cloneObj) {
4855
4877
  if (
4856
- value.hasOwnProperty(k)
4878
+ cloneObj.hasOwnProperty(k)
4857
4879
  && bindingStyleNamesForPx2Rem$1.indexOf(k) > -1
4858
4880
  ) {
4859
- value[k] = weex.utils.px2rem(value[k] + '', rootValue);
4881
+ cloneObj[k] = weex.utils.px2rem(cloneObj[k] + '', rootValue);
4860
4882
  }
4861
4883
  }
4862
- return value
4884
+ return cloneObj
4863
4885
  }
4864
4886
  if (isArray(value)) {
4865
- for (var i = 0, l = value.length; i < l; i++) {
4866
- this$1._px2rem(value[i], rootValue);
4887
+ let cloneArr = this._deepClone(value)
4888
+ for (var i = 0, l = cloneArr.length; i < l; i++) {
4889
+ this$1._px2rem(cloneArr[i], rootValue);
4867
4890
  }
4868
- return value
4891
+ return cloneArr
4869
4892
  }
4870
4893
  },
4871
4894
 
@@ -5922,6 +5945,11 @@ function getList (weex) {
5922
5945
  if (isAbsoluteOrFixedPositioned(this$1.$el)) {
5923
5946
  this$1.$el.classList.remove("height-0");
5924
5947
  }
5948
+ setTimeout(() => {
5949
+ if (this$1.$el.clientHeight == 0) {
5950
+ this$1.$el.classList.remove("height-0");
5951
+ }
5952
+ }, 0);
5925
5953
  },
5926
5954
  methods: {
5927
5955
  createChildren: function createChildren (h) {
@@ -6013,6 +6041,11 @@ function getScroller (weex) {
6013
6041
  if (isAbsoluteOrFixedPositioned(this$1.$el)) {
6014
6042
  this$1.$el.classList.remove("height-0");
6015
6043
  }
6044
+ setTimeout(() => {
6045
+ if (this$1.$el.clientHeight == 0) {
6046
+ this$1.$el.classList.remove("height-0");
6047
+ }
6048
+ }, 0);
6016
6049
  },
6017
6050
  computed: {
6018
6051
  wrapperClass: function wrapperClass () {
@@ -6924,6 +6957,11 @@ function getList$1 (weex) {
6924
6957
  if (isAbsoluteOrFixedPositioned(this$1.$el)) {
6925
6958
  this$1.$el.classList.remove("height-0");
6926
6959
  }
6960
+ setTimeout(() => {
6961
+ if (this$1.$el.clientHeight == 0) {
6962
+ this$1.$el.classList.remove("height-0");
6963
+ }
6964
+ }, 0);
6927
6965
  },
6928
6966
  computed: {
6929
6967
  wrapperClass: function wrapperClass () {
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.1.7"
52
+ "version": "0.1.8"
53
53
  }