@dolphinweex/weex-vue-render 0.2.44 → 0.2.45

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "compile-hero.disable-compile-files-on-did-save-code": true
3
+ }
@@ -5547,10 +5547,18 @@ function getInput (weex) {
5547
5547
  },
5548
5548
 
5549
5549
  mounted: function mounted () {
5550
- if (this.autofocus !== 'false' && this.autofocus !== false) {
5550
+ if (this.autofocus !== 'false' || this.autofocus !== false) {
5551
5551
  this.focus(this.autofocus)
5552
5552
  }
5553
5553
  },
5554
+ //用watch监听新值,处理可能页面可能通过setimeout重新赋值的情况
5555
+ watch: {
5556
+ autofocus: function autofocus(val) {
5557
+ if (val !== 'false' || val !== false) {
5558
+ this.focus(val)
5559
+ }
5560
+ },
5561
+ },
5554
5562
 
5555
5563
  render: function render (createElement) {
5556
5564
  if (!this._id) {
@@ -5589,6 +5597,88 @@ var input = {
5589
5597
  }
5590
5598
  };
5591
5599
 
5600
+ function getImage(weex) {
5601
+ var ref = weex.utils;
5602
+ var dispatchNativeEvent = ref.dispatchNativeEvent;
5603
+ return {
5604
+ data: function data() {
5605
+ return {
5606
+ }
5607
+ },
5608
+ name: 'weex-image',
5609
+ props: {
5610
+ src: String,
5611
+ saveImg: {
5612
+ type: [String],
5613
+ default: ''
5614
+ },
5615
+ },
5616
+ created: function created() {
5617
+ this.currentSrc = this.src;
5618
+ },
5619
+ mounted: function () {
5620
+ },
5621
+ watch: {
5622
+ src: function src(val) {
5623
+ }
5624
+ },
5625
+ methods: {
5626
+ save: function (callback) {
5627
+ const params = {
5628
+ operation: 'saveImageToPhotosAlbum',
5629
+ params: {
5630
+ src: this.saveImg
5631
+ }
5632
+ }
5633
+ weex.requireModule('bridgeModule').commandInterface(JSON.stringify(params),
5634
+ (resData) => {
5635
+ if (typeof callback === 'function') {
5636
+ callback({ success: true });
5637
+ }
5638
+ },
5639
+ (error) => {
5640
+ if (typeof callback === 'function') {
5641
+ callback({ success: false });
5642
+ }
5643
+ }
5644
+ )
5645
+ },
5646
+ handleClick: function handleClick(event) {
5647
+ // weex.utils.dispatchNativeEvent(this.$el, 'click')
5648
+ if (this.$listeners && this.$listeners.click) {
5649
+ this.$listeners.click(event);
5650
+ }
5651
+ },
5652
+ _handleTouchStart: function _handleTouchStart (event) {
5653
+ if (this.saveImg) {
5654
+ this.save()
5655
+ }
5656
+ }
5657
+ },
5658
+ render: function render (createElement) {
5659
+ return createElement('html:img', {
5660
+ attrs: {
5661
+ 'weex-type': 'image',
5662
+ src: this.src,
5663
+ },
5664
+ on: {
5665
+ // click: this.handleClick,
5666
+ touchstart: this._handleTouchStart,
5667
+ },
5668
+ staticClass: 'weex-image weex-el',
5669
+ staticStyle: weex.extractComponentStyle(this)
5670
+ })
5671
+ }
5672
+ }
5673
+ }
5674
+
5675
+
5676
+ var image = {
5677
+ init: function init (weex) {
5678
+ weex.registerComponent('image', getImage(weex));
5679
+ }
5680
+ };
5681
+
5592
5682
  __$styleInject("/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n.weex-switch {\n border: 0.013333rem solid #dfdfdf;\n cursor: pointer;\n vertical-align: middle;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n background-clip: content-box;\n color: #64bd63;\n width: 1.333333rem;\n height: 0.8rem;\n background-color: white;\n border-color: #dfdfdf;\n -webkit-box-shadow: #dfdfdf 0 0 0 0 inset;\n box-shadow: #dfdfdf 0 0 0 0 inset;\n border-radius: 0.8rem;\n -webkit-transition: border 0.4s, background-color 1.2s, -webkit-box-shadow 0.4s;\n transition: border 0.4s, background-color 1.2s, -webkit-box-shadow 0.4s;\n transition: border 0.4s, box-shadow 0.4s, background-color 1.2s;\n transition: border 0.4s, box-shadow 0.4s, background-color 1.2s, -webkit-box-shadow 0.4s;\n}\n\n.weex-switch-checked {\n background-color: #64bd63;\n border-color: #64bd63;\n -webkit-box-shadow: #64bd63 0 0 0 0.533333rem inset;\n box-shadow: #64bd63 0 0 0 0.533333rem inset;\n}\n\n.weex-switch-checked.weex-switch-disabled {\n opacity: 0.3\n}\n\n.weex-switch-disabled {\n background-color: #EEEEEE;\n}\n\n.weex-switch-inner {\n width: 0.8rem;\n height: 0.8rem;\n background: #fff;\n border-radius: 100%;\n -webkit-box-shadow: 0 0.013333rem 0.04rem rgba(0, 0, 0, 0.4);\n box-shadow: 0 0.013333rem 0.04rem rgba(0, 0, 0, 0.4);\n position: absolute;\n top: 0;\n left: 0;\n -webkit-transition: background-color 0.4s, left 0.2s;\n transition: background-color 0.4s, left 0.2s;\n}\n\n.weex-switch-checked > .weex-switch-inner {\n left: 0.533333rem;\n}\n",undefined);
5593
5683
 
5594
5684
  /*
@@ -8263,6 +8353,10 @@ var slideMixin = {
8263
8353
  if (!this.scrollable || this.frameCount<=1) {
8264
8354
  return // 🚫 禁止滚动行为
8265
8355
  }
8356
+ // if(weex.weexSliderTouchStart){ //解决weex-slider嵌套手势冲突问题
8357
+ // return
8358
+ // }
8359
+ // weex.weexSliderTouchStart = true
8266
8360
  this.lastMoveTime = Date.now();
8267
8361
  this.lastMovePosition = event.touches[0].pageX;
8268
8362
  var touch = event.changedTouches[0];
@@ -8297,7 +8391,9 @@ var slideMixin = {
8297
8391
  },
8298
8392
  _handleTouchMove: function _handleTouchMove (event) {
8299
8393
  var tp = this._touchParams;
8300
- if (!tp) { return }
8394
+ if (!tp || !this.scrollable || this.frameCount<=1 || this._sliding) {
8395
+ return // 🚫 禁止滚动行为
8396
+ }
8301
8397
 
8302
8398
  // 如果子view已经处在swipe事件中,并切不允许事件冒泡则不处理当前的事件
8303
8399
  if (weex.gestureAleadyHandleSwipeOnce && !weex.gestureHandleSwipeCanPropagation) {
@@ -8319,7 +8415,7 @@ var slideMixin = {
8319
8415
  if (deltaTime > 0) {
8320
8416
  this.velocity = deltaX / deltaTime; // 像素/毫秒
8321
8417
  // 计算动画时间,速度越大动画时间越短
8322
- const baseTime = TRANSITION_TIME / 1000; // 基准时间
8418
+ const baseTime = TRANSITION_TIME / 1200; // 基准时间
8323
8419
  const minTime = 0.1; // 最小动画时间(秒)
8324
8420
  this.transitionDuration = Math.max(minTime, baseTime / (this.velocity + 1));
8325
8421
  }
@@ -8414,7 +8510,7 @@ var slideMixin = {
8414
8510
  },
8415
8511
 
8416
8512
  _handleTouchEnd: function _handleTouchEnd (event) {
8417
- weex.sliderHorizontalScrolling = false;
8513
+ // weex.weexSliderTouchStart = false
8418
8514
  var inner = this.$refs.inner;
8419
8515
  if (touchSliderInstance == inner) {
8420
8516
  touchSliderInstance= null;
@@ -8438,13 +8534,13 @@ var slideMixin = {
8438
8534
  var reset = Math.abs(offsetX / this._wrapperWidth) < 0.2;
8439
8535
  var direction = offsetX > 0 ? 1 : -1;
8440
8536
  var newIndex = reset ? this.currentIndex : (this.currentIndex - direction);
8441
- this._slideTo(newIndex, true);
8537
+ this._slideTo(newIndex, true ,this.transitionDuration);
8442
8538
  }
8443
8539
  delete this._touchParams;
8540
+ weex.sliderHorizontalScrolling = false;
8444
8541
  },
8445
8542
 
8446
8543
  _handleTouchCancel: function _handleTouchCancel (event) {
8447
- weex.sliderHorizontalScrolling = false;
8448
8544
  var inner = this.$refs.inner;
8449
8545
  if (touchSliderInstance == inner) {
8450
8546
  touchSliderInstance= null;
@@ -9182,7 +9278,7 @@ var web = {
9182
9278
  var components = [
9183
9279
  // a,
9184
9280
  // div,
9185
- // image,
9281
+ image,
9186
9282
  input,
9187
9283
  _switch,
9188
9284
  scrollable,
@@ -11496,6 +11592,8 @@ var valMap = {
11496
11592
  var vals = Object.keys(valMap);
11497
11593
  var defaultVal = 'stretch';
11498
11594
 
11595
+
11596
+
11499
11597
  var resize = {
11500
11598
  init: function init (weex) {
11501
11599
  weex.__vue__.directive('weex-resize', function (el, binding) {
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.44"
52
+ "version": "0.2.45"
53
53
  }