@dolphinweex/weex-vue-render 0.2.36 → 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.
@@ -5120,9 +5120,12 @@ var findEnterKeyType = function (key) {
5120
5120
 
5121
5121
  var inputCommon = {
5122
5122
  methods: {
5123
- focus: function focus () {
5123
+ focus: function focus (autofocus) {
5124
+ // 当是自动聚焦时才需要主动弹出键盘,否则会导致键盘弹出但是组件失去焦点
5125
+ if (autofocus) {
5126
+ this.$el && weex.requireModule('bridgeModule').commandInterface(JSON.stringify({ operation: 'showKeyboard'}))
5127
+ }
5124
5128
  this.$el && this.$el.focus();
5125
- this.$el && weex.requireModule('bridgeModule').commandInterface(JSON.stringify({ operation: 'showKeyboard'}))
5126
5129
  },
5127
5130
  blur: function blur () {
5128
5131
  this.$el && this.$el.blur();
@@ -5534,7 +5537,7 @@ function getInput (weex) {
5534
5537
 
5535
5538
  mounted: function mounted () {
5536
5539
  if (this.autofocus !== 'false' && this.autofocus !== false) {
5537
- this.focus()
5540
+ this.focus(this.autofocus)
5538
5541
  }
5539
5542
  },
5540
5543
 
@@ -5800,6 +5803,11 @@ function getThrottledScroll (context) {
5800
5803
 
5801
5804
  var scrollable$1 = {
5802
5805
  props: {
5806
+ scrollable: {
5807
+ type: [Boolean],
5808
+ default: true
5809
+ },
5810
+
5803
5811
  loadmoreoffset: {
5804
5812
  type: [String, Number],
5805
5813
  default: DEFAULT_LOADMORE_OFFSET,
@@ -5833,6 +5841,55 @@ var scrollable$1 = {
5833
5841
  },
5834
5842
 
5835
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
+ },
5836
5893
  updateLayout: function updateLayout () {
5837
5894
  var wrapper = this.$refs.wrapper;
5838
5895
  if (wrapper) {
@@ -6035,6 +6092,9 @@ var scrollable$1 = {
6035
6092
  if (!this._touchParams) {
6036
6093
  return
6037
6094
  }
6095
+ if (!this.scrollable) {
6096
+ return
6097
+ }
6038
6098
 
6039
6099
  var tp = this._touchParams;
6040
6100
  if (!tp) { return }
@@ -6178,12 +6238,6 @@ function getList (weex) {
6178
6238
 
6179
6239
  return {
6180
6240
  name: 'weex-list',
6181
- props: {
6182
- scrollable: {
6183
- type: [Boolean],
6184
- default: true
6185
- }
6186
- },
6187
6241
  mixins: [scrollable$1],
6188
6242
  computed: {
6189
6243
  wrapperClass: function wrapperClass () {
@@ -6338,11 +6392,13 @@ function getScroller (weex) {
6338
6392
  if (!vnode.tag && !trimmedText) { return false }
6339
6393
  return true
6340
6394
  });
6395
+ const cellsWithScopeIds = this.applyScopeIdsToVNodes(this._cells, this);
6396
+
6341
6397
  return [
6342
6398
  h('article', {
6343
6399
  ref: 'inner',
6344
6400
  staticClass: 'weex-scroller-inner weex-ct'
6345
- }, this._cells)
6401
+ }, cellsWithScopeIds)
6346
6402
  ]
6347
6403
  }
6348
6404
  },
@@ -6740,7 +6796,7 @@ function getWaterfall (weex) {
6740
6796
  },
6741
6797
  staticClass: 'weex-ct',
6742
6798
  staticStyle: {
6743
- width: this$1._columnWidth + 'px',
6799
+ // width: this$1._columnWidth + 'px',
6744
6800
  marginLeft: i$1 === 0 ? 0 : this$1._columnGap + 'px'
6745
6801
  }
6746
6802
  }, columnCells[i$1]));
@@ -8759,7 +8815,7 @@ function getTextarea (weex) {
8759
8815
 
8760
8816
  mounted: function mounted () {
8761
8817
  if (this.autofocus !== 'false' && this.autofocus !== false) {
8762
- this.focus()
8818
+ this.focus(this.autofocus)
8763
8819
  }
8764
8820
  },
8765
8821
 
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.36"
52
+ "version": "0.2.38"
53
53
  }