@dolphinweex/weex-vue-render 0.2.37 → 0.2.38

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.
@@ -5803,6 +5803,11 @@ function getThrottledScroll (context) {
5803
5803
 
5804
5804
  var scrollable$1 = {
5805
5805
  props: {
5806
+ scrollable: {
5807
+ type: [Boolean],
5808
+ default: true
5809
+ },
5810
+
5806
5811
  loadmoreoffset: {
5807
5812
  type: [String, Number],
5808
5813
  default: DEFAULT_LOADMORE_OFFSET,
@@ -5836,6 +5841,55 @@ var scrollable$1 = {
5836
5841
  },
5837
5842
 
5838
5843
  methods: {
5844
+ /**
5845
+ * 给虚拟节点数组添加作用域ID
5846
+ * @param {Array} vnodes - 虚拟节点数组
5847
+ * @param {Object} context - Vue组件实例上下文
5848
+ * @returns {Array} 添加了作用域ID的虚拟节点数组
5849
+ */
5850
+ applyScopeIdsToVNodes: function applyScopeIdsToVNodes (vnodes, context) {
5851
+ const scopeIds = this.getScopeIds(context);
5852
+ const attrs = {};
5853
+ for (let i = 0, l = scopeIds.length; i < l; i++) {
5854
+ attrs[scopeIds[i]] = '';
5855
+ }
5856
+ // 给每个子级节点添加作用域ID
5857
+ return vnodes.map(function (vnode) {
5858
+ if (vnode && vnode.data) {
5859
+ // 如果vnode已有attrs,则合并作用域ID
5860
+ if (!vnode.data.attrs) {
5861
+ vnode.data.attrs = {};
5862
+ }
5863
+ Object.assign(vnode.data.attrs, attrs);
5864
+ } else if (vnode) {
5865
+ // 如果vnode没有data,则创建data和attrs
5866
+ vnode.data = vnode.data || {};
5867
+ vnode.data.attrs = Object.assign({}, attrs);
5868
+ }
5869
+ return vnode;
5870
+ });
5871
+ },
5872
+ getScopeIds: function getScopeIds (context) {
5873
+ // 获取父级作用域ID
5874
+ var scopeIds = context._scopeIds;
5875
+ if (scopeIds) {
5876
+ return scopeIds
5877
+ }
5878
+ else {
5879
+ scopeIds = [];
5880
+ }
5881
+ var parent = context.$parent;
5882
+ //一般绝不可能没父级
5883
+ while (parent) {
5884
+ var i = (void 0);
5885
+ if ((i = parent.$options) && (i = i._scopeId)) {
5886
+ scopeIds.push(i);
5887
+ }
5888
+ parent = parent.$parent;
5889
+ }
5890
+ context._scopeIds = scopeIds;
5891
+ return scopeIds
5892
+ },
5839
5893
  updateLayout: function updateLayout () {
5840
5894
  var wrapper = this.$refs.wrapper;
5841
5895
  if (wrapper) {
@@ -6038,6 +6092,9 @@ var scrollable$1 = {
6038
6092
  if (!this._touchParams) {
6039
6093
  return
6040
6094
  }
6095
+ if (!this.scrollable) {
6096
+ return
6097
+ }
6041
6098
 
6042
6099
  var tp = this._touchParams;
6043
6100
  if (!tp) { return }
@@ -6181,12 +6238,6 @@ function getList (weex) {
6181
6238
 
6182
6239
  return {
6183
6240
  name: 'weex-list',
6184
- props: {
6185
- scrollable: {
6186
- type: [Boolean],
6187
- default: true
6188
- }
6189
- },
6190
6241
  mixins: [scrollable$1],
6191
6242
  computed: {
6192
6243
  wrapperClass: function wrapperClass () {
@@ -6341,11 +6392,13 @@ function getScroller (weex) {
6341
6392
  if (!vnode.tag && !trimmedText) { return false }
6342
6393
  return true
6343
6394
  });
6395
+ const cellsWithScopeIds = this.applyScopeIdsToVNodes(this._cells, this);
6396
+
6344
6397
  return [
6345
6398
  h('article', {
6346
6399
  ref: 'inner',
6347
6400
  staticClass: 'weex-scroller-inner weex-ct'
6348
- }, this._cells)
6401
+ }, cellsWithScopeIds)
6349
6402
  ]
6350
6403
  }
6351
6404
  },
@@ -6743,7 +6796,7 @@ function getWaterfall (weex) {
6743
6796
  },
6744
6797
  staticClass: 'weex-ct',
6745
6798
  staticStyle: {
6746
- width: this$1._columnWidth + 'px',
6799
+ // width: this$1._columnWidth + 'px',
6747
6800
  marginLeft: i$1 === 0 ? 0 : this$1._columnGap + 'px'
6748
6801
  }
6749
6802
  }, columnCells[i$1]));
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.37"
52
+ "version": "0.2.38"
53
53
  }