@dolphinweex/weex-vue-render 0.2.43 → 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.
- package/.vscode/settings.json +3 -0
- package/dist/index.common.js +112 -8
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -1547,7 +1547,7 @@ function calc(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
|
1547
1547
|
* @event
|
|
1548
1548
|
* @param {event} event
|
|
1549
1549
|
*/
|
|
1550
|
-
function touchstartHandler(event) {
|
|
1550
|
+
const touchstartHandler = throttle(function touchstartHandler(event) {
|
|
1551
1551
|
|
|
1552
1552
|
if (Object.keys(gestures).length === 0) {
|
|
1553
1553
|
docEl.addEventListener('touchmove', touchmoveHandler, true);
|
|
@@ -1603,7 +1603,7 @@ function touchstartHandler(event) {
|
|
|
1603
1603
|
touchEvent: event
|
|
1604
1604
|
});
|
|
1605
1605
|
}
|
|
1606
|
-
}
|
|
1606
|
+
},300,true)
|
|
1607
1607
|
|
|
1608
1608
|
/**
|
|
1609
1609
|
* take over touchmove events, and handle pan and dual related gestures.
|
|
@@ -3373,8 +3373,8 @@ function watchAppear (context, fireNow) {
|
|
|
3373
3373
|
* 此处延时执行是临时规避措施,后续需要优化
|
|
3374
3374
|
*/
|
|
3375
3375
|
if (i == 0) {
|
|
3376
|
-
|
|
3377
|
-
|
|
3376
|
+
setTimeout(() => {
|
|
3377
|
+
detectAppear(el, visibleData, dir);
|
|
3378
3378
|
}, 1);
|
|
3379
3379
|
} else {
|
|
3380
3380
|
detectAppear(el, visibleData, dir);
|
|
@@ -5547,10 +5547,18 @@ function getInput (weex) {
|
|
|
5547
5547
|
},
|
|
5548
5548
|
|
|
5549
5549
|
mounted: function mounted () {
|
|
5550
|
-
if (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
|
/*
|
|
@@ -7180,6 +7270,9 @@ function getRefresh (weex) {
|
|
|
7180
7270
|
},
|
|
7181
7271
|
methods: {
|
|
7182
7272
|
pulling: function pulling (offsetY) {
|
|
7273
|
+
if(weex.sliderHorizontalScrolling){//轮播图滚动中不允许触发
|
|
7274
|
+
return
|
|
7275
|
+
}
|
|
7183
7276
|
if ( offsetY === void 0 ) offsetY = 0;
|
|
7184
7277
|
|
|
7185
7278
|
this.height = offsetY;
|
|
@@ -8260,6 +8353,10 @@ var slideMixin = {
|
|
|
8260
8353
|
if (!this.scrollable || this.frameCount<=1) {
|
|
8261
8354
|
return // 🚫 禁止滚动行为
|
|
8262
8355
|
}
|
|
8356
|
+
// if(weex.weexSliderTouchStart){ //解决weex-slider嵌套手势冲突问题
|
|
8357
|
+
// return
|
|
8358
|
+
// }
|
|
8359
|
+
// weex.weexSliderTouchStart = true
|
|
8263
8360
|
this.lastMoveTime = Date.now();
|
|
8264
8361
|
this.lastMovePosition = event.touches[0].pageX;
|
|
8265
8362
|
var touch = event.changedTouches[0];
|
|
@@ -8294,7 +8391,9 @@ var slideMixin = {
|
|
|
8294
8391
|
},
|
|
8295
8392
|
_handleTouchMove: function _handleTouchMove (event) {
|
|
8296
8393
|
var tp = this._touchParams;
|
|
8297
|
-
if (!tp) {
|
|
8394
|
+
if (!tp || !this.scrollable || this.frameCount<=1 || this._sliding) {
|
|
8395
|
+
return // 🚫 禁止滚动行为
|
|
8396
|
+
}
|
|
8298
8397
|
|
|
8299
8398
|
// 如果子view已经处在swipe事件中,并切不允许事件冒泡则不处理当前的事件
|
|
8300
8399
|
if (weex.gestureAleadyHandleSwipeOnce && !weex.gestureHandleSwipeCanPropagation) {
|
|
@@ -8316,7 +8415,7 @@ var slideMixin = {
|
|
|
8316
8415
|
if (deltaTime > 0) {
|
|
8317
8416
|
this.velocity = deltaX / deltaTime; // 像素/毫秒
|
|
8318
8417
|
// 计算动画时间,速度越大动画时间越短
|
|
8319
|
-
const baseTime = TRANSITION_TIME /
|
|
8418
|
+
const baseTime = TRANSITION_TIME / 1200; // 基准时间
|
|
8320
8419
|
const minTime = 0.1; // 最小动画时间(秒)
|
|
8321
8420
|
this.transitionDuration = Math.max(minTime, baseTime / (this.velocity + 1));
|
|
8322
8421
|
}
|
|
@@ -8328,6 +8427,7 @@ var slideMixin = {
|
|
|
8328
8427
|
isV = tp.isVertical = Math.abs(offsetX) < Math.abs(offsetY);
|
|
8329
8428
|
if (!isV) {
|
|
8330
8429
|
this._emitScrollEvent('scrollstart');
|
|
8430
|
+
weex.sliderHorizontalScrolling = true;
|
|
8331
8431
|
}
|
|
8332
8432
|
}
|
|
8333
8433
|
// vertical scroll. just ignore it.
|
|
@@ -8410,6 +8510,7 @@ var slideMixin = {
|
|
|
8410
8510
|
},
|
|
8411
8511
|
|
|
8412
8512
|
_handleTouchEnd: function _handleTouchEnd (event) {
|
|
8513
|
+
// weex.weexSliderTouchStart = false
|
|
8413
8514
|
var inner = this.$refs.inner;
|
|
8414
8515
|
if (touchSliderInstance == inner) {
|
|
8415
8516
|
touchSliderInstance= null;
|
|
@@ -8436,6 +8537,7 @@ var slideMixin = {
|
|
|
8436
8537
|
this._slideTo(newIndex, true ,this.transitionDuration);
|
|
8437
8538
|
}
|
|
8438
8539
|
delete this._touchParams;
|
|
8540
|
+
weex.sliderHorizontalScrolling = false;
|
|
8439
8541
|
},
|
|
8440
8542
|
|
|
8441
8543
|
_handleTouchCancel: function _handleTouchCancel (event) {
|
|
@@ -9176,7 +9278,7 @@ var web = {
|
|
|
9176
9278
|
var components = [
|
|
9177
9279
|
// a,
|
|
9178
9280
|
// div,
|
|
9179
|
-
|
|
9281
|
+
image,
|
|
9180
9282
|
input,
|
|
9181
9283
|
_switch,
|
|
9182
9284
|
scrollable,
|
|
@@ -11490,6 +11592,8 @@ var valMap = {
|
|
|
11490
11592
|
var vals = Object.keys(valMap);
|
|
11491
11593
|
var defaultVal = 'stretch';
|
|
11492
11594
|
|
|
11595
|
+
|
|
11596
|
+
|
|
11493
11597
|
var resize = {
|
|
11494
11598
|
init: function init (weex) {
|
|
11495
11599
|
weex.__vue__.directive('weex-resize', function (el, binding) {
|
package/package.json
CHANGED