@dolphinweex/weex-vue-render 0.2.106 → 0.2.107
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/dist/index.common.js +129 -24
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -10,7 +10,16 @@ console.log('START WEEX VUE RENDER: 1.0.36, Build 2018-12-29 17:52.');
|
|
|
10
10
|
|
|
11
11
|
// 记录当前已经添加过的字体
|
|
12
12
|
const AddedRules = {}
|
|
13
|
-
|
|
13
|
+
// localStorage.setItem('weexVueRenderLog',true) 开启日志
|
|
14
|
+
function __renderLog(title,log){
|
|
15
|
+
try{
|
|
16
|
+
if(localStorage && localStorage.getItem('weexVueRenderLog')){
|
|
17
|
+
console.log('[weexVueRender]' + title + ': ' + JSON.stringify(log) + ' ' + console.trace());
|
|
18
|
+
}
|
|
19
|
+
}catch(e){
|
|
20
|
+
console.error(`${JSON.stringify(e)}`)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
14
23
|
function __$styleInject(css, returnValue) {
|
|
15
24
|
if (typeof document === 'undefined') {
|
|
16
25
|
return returnValue;
|
|
@@ -2767,7 +2776,7 @@ function init$1 (viewportWidth) {
|
|
|
2767
2776
|
deviceWidth: screenWidth * dpr,
|
|
2768
2777
|
deviceHeight: screenHeight * dpr
|
|
2769
2778
|
});
|
|
2770
|
-
|
|
2779
|
+
__renderLog('[px2rem] poll@' + label + ' applied: fontSize=' + doc.documentElement.style.fontSize + ', scale=' + newScale);
|
|
2771
2780
|
}
|
|
2772
2781
|
}, delay);
|
|
2773
2782
|
};
|
|
@@ -8233,13 +8242,24 @@ var slideMixin = {
|
|
|
8233
8242
|
_slideTo: function _slideTo(index, isTouchScroll, transtionTime = null) {
|
|
8234
8243
|
let slideTranstionTime = this.isTransform ? `transform ${transtionTime || TRANSITION_TIME / 1600}s ease-out` : `left ${transtionTime || TRANSITION_TIME / 1600}s ease-out`
|
|
8235
8244
|
var this$1 = this;
|
|
8245
|
+
__renderLog('[weex-slider] _slideTo enter', {
|
|
8246
|
+
index: index,
|
|
8247
|
+
isTouchScroll: isTouchScroll,
|
|
8248
|
+
currentIndex: this.currentIndex,
|
|
8249
|
+
preIndex: this._preIndex,
|
|
8250
|
+
sliding: this._sliding,
|
|
8251
|
+
inited: this._inited,
|
|
8252
|
+
frameCount: this.frameCount
|
|
8253
|
+
});
|
|
8236
8254
|
if (this.frameCount <= 0) {
|
|
8255
|
+
__renderLog('[weex-slider] _slideTo return: frameCount<=0');
|
|
8237
8256
|
return;
|
|
8238
8257
|
}
|
|
8239
8258
|
//一张图片无需滚动操作
|
|
8240
8259
|
if (this.frameCount <= 1) {
|
|
8241
8260
|
this.currentIndex = 0;
|
|
8242
8261
|
this._preIndex = 0;
|
|
8262
|
+
__renderLog('[weex-slider] _slideTo return: frameCount<=1');
|
|
8243
8263
|
return;
|
|
8244
8264
|
}
|
|
8245
8265
|
// 非无限轮播的边界处理
|
|
@@ -8255,6 +8275,7 @@ var slideMixin = {
|
|
|
8255
8275
|
}
|
|
8256
8276
|
|
|
8257
8277
|
if (this._sliding) {
|
|
8278
|
+
__renderLog('[weex-slider] _slideTo return: already sliding');
|
|
8258
8279
|
return;
|
|
8259
8280
|
}
|
|
8260
8281
|
this._sliding = true;
|
|
@@ -8374,14 +8395,19 @@ var slideMixin = {
|
|
|
8374
8395
|
}, TRANSITION_TIME);
|
|
8375
8396
|
}
|
|
8376
8397
|
|
|
8377
|
-
|
|
8398
|
+
// 先同步内部 index,再派发 change,避免外部 :index 回写再次 _slideTo 闪动
|
|
8399
|
+
var prevIndex = this._preIndex;
|
|
8400
|
+
this.currentIndex = index;
|
|
8401
|
+
this._preIndex = index;
|
|
8402
|
+
__renderLog('[weex-slider] _slideTo sync index before change', {
|
|
8403
|
+
prevIndex: prevIndex,
|
|
8404
|
+
index: index
|
|
8405
|
+
});
|
|
8406
|
+
if (index !== prevIndex) {
|
|
8378
8407
|
weex.utils.dispatchNativeEvent(this.$el, 'change', {
|
|
8379
8408
|
index: index
|
|
8380
8409
|
});
|
|
8381
8410
|
}
|
|
8382
|
-
|
|
8383
|
-
this.currentIndex = index;
|
|
8384
|
-
this._preIndex = index;
|
|
8385
8411
|
},
|
|
8386
8412
|
// 优化_prepareNodes方法以支持无缝切换
|
|
8387
8413
|
_prepareNodes: function _prepareNodes() {
|
|
@@ -8794,6 +8820,11 @@ var slideMixin = {
|
|
|
8794
8820
|
this._clearNodes(2, this._showEndIdx);
|
|
8795
8821
|
this._showEndIdx = 1;
|
|
8796
8822
|
this._sliding = false;
|
|
8823
|
+
__renderLog('[weex-slider] _rearrangeNodes clear sliding', {
|
|
8824
|
+
newIndex: newIndex,
|
|
8825
|
+
currentIndex: this.currentIndex,
|
|
8826
|
+
preIndex: this._preIndex
|
|
8827
|
+
});
|
|
8797
8828
|
|
|
8798
8829
|
// set current index to the new index.
|
|
8799
8830
|
this.currentIndex = newIndex;
|
|
@@ -8861,13 +8892,34 @@ var slideMixin = {
|
|
|
8861
8892
|
}
|
|
8862
8893
|
}
|
|
8863
8894
|
if (!this.scrollable || this.frameCount<=1) {
|
|
8895
|
+
__renderLog('[weex-slider] _handleTouchStart return: not scrollable', {
|
|
8896
|
+
scrollable: this.scrollable,
|
|
8897
|
+
frameCount: this.frameCount
|
|
8898
|
+
});
|
|
8864
8899
|
return // 🚫 禁止滚动行为
|
|
8865
8900
|
}
|
|
8866
8901
|
if(weex.weexSliderTouchStart && !weex.weexSliderTouchBoundary){
|
|
8902
|
+
__renderLog('[weex-slider] _handleTouchStart return: another slider touching');
|
|
8867
8903
|
return
|
|
8868
8904
|
}
|
|
8905
|
+
// _sliding 卡住时会导致完全划不动,这里兜底释放
|
|
8906
|
+
if (this._sliding) {
|
|
8907
|
+
__renderLog('[weex-slider] _handleTouchStart force clear stuck _sliding');
|
|
8908
|
+
this._sliding = false;
|
|
8909
|
+
var stuckInner = this.$refs.inner;
|
|
8910
|
+
if (stuckInner) {
|
|
8911
|
+
stuckInner.style.transition = 'none';
|
|
8912
|
+
}
|
|
8913
|
+
}
|
|
8869
8914
|
weex.weexSliderTouchStart = true
|
|
8870
8915
|
|
|
8916
|
+
__renderLog('[weex-slider] _handleTouchStart', {
|
|
8917
|
+
currentIndex: this.currentIndex,
|
|
8918
|
+
preIndex: this._preIndex,
|
|
8919
|
+
sliding: this._sliding,
|
|
8920
|
+
frameCount: this.frameCount
|
|
8921
|
+
});
|
|
8922
|
+
|
|
8871
8923
|
// 重置velocity相关变量
|
|
8872
8924
|
this.lastMoveTime = Date.now();
|
|
8873
8925
|
this.lastMovePosition = event.touches[0].pageX;
|
|
@@ -8907,6 +8959,9 @@ var slideMixin = {
|
|
|
8907
8959
|
_handleTouchMove: function _handleTouchMove (event) {
|
|
8908
8960
|
var tp = this._touchParams;
|
|
8909
8961
|
if (!tp || !this.scrollable || this.frameCount<=1 || this._sliding) {
|
|
8962
|
+
if (this._sliding) {
|
|
8963
|
+
__renderLog('[weex-slider] _handleTouchMove blocked by _sliding');
|
|
8964
|
+
}
|
|
8910
8965
|
return // 🚫 禁止滚动行为
|
|
8911
8966
|
}
|
|
8912
8967
|
|
|
@@ -9059,13 +9114,22 @@ var slideMixin = {
|
|
|
9059
9114
|
if (touchSliderInstance == inner) {
|
|
9060
9115
|
touchSliderInstance= null;
|
|
9061
9116
|
} else {
|
|
9117
|
+
__renderLog('[weex-slider] _handleTouchEnd return: not active touchSliderInstance', {
|
|
9118
|
+
hasInner: !!inner,
|
|
9119
|
+
sliding: this._sliding,
|
|
9120
|
+
currentIndex: this.currentIndex
|
|
9121
|
+
});
|
|
9062
9122
|
return;
|
|
9063
9123
|
}
|
|
9064
9124
|
|
|
9065
9125
|
var tp = this._touchParams;
|
|
9066
|
-
if (!tp) {
|
|
9126
|
+
if (!tp) {
|
|
9127
|
+
__renderLog('[weex-slider] _handleTouchEnd return: no _touchParams');
|
|
9128
|
+
return
|
|
9129
|
+
}
|
|
9067
9130
|
var isV = tp.isVertical;
|
|
9068
9131
|
if (typeof isV === 'undefined' || isV) {
|
|
9132
|
+
__renderLog('[weex-slider] _handleTouchEnd return: vertical or unset', { isV: isV });
|
|
9069
9133
|
return
|
|
9070
9134
|
}
|
|
9071
9135
|
|
|
@@ -9099,6 +9163,16 @@ var slideMixin = {
|
|
|
9099
9163
|
if (newIndex < 0) newIndex = 0;
|
|
9100
9164
|
if (newIndex >= this.frameCount) newIndex = this.frameCount - 1;
|
|
9101
9165
|
}
|
|
9166
|
+
__renderLog('[weex-slider] _handleTouchEnd', {
|
|
9167
|
+
offsetX: offsetX,
|
|
9168
|
+
moveRatio: moveRatio,
|
|
9169
|
+
shouldSwitch: shouldSwitch,
|
|
9170
|
+
newIndex: newIndex,
|
|
9171
|
+
currentIndex: this.currentIndex,
|
|
9172
|
+
preIndex: this._preIndex,
|
|
9173
|
+
sliding: this._sliding,
|
|
9174
|
+
animationDuration: animationDuration
|
|
9175
|
+
});
|
|
9102
9176
|
|
|
9103
9177
|
// 如果是复位操作(没有切换页面),使用更平滑的动画
|
|
9104
9178
|
if (newIndex === this.currentIndex) {
|
|
@@ -9152,6 +9226,15 @@ var slideMixin = {
|
|
|
9152
9226
|
// 平滑切换到目标页面
|
|
9153
9227
|
_smoothSlideTo: function _smoothSlideTo(newIndex, duration, moveRatio) {
|
|
9154
9228
|
var this$1 = this;
|
|
9229
|
+
__renderLog('[weex-slider] _smoothSlideTo enter', {
|
|
9230
|
+
newIndex: newIndex,
|
|
9231
|
+
duration: duration,
|
|
9232
|
+
moveRatio: moveRatio,
|
|
9233
|
+
currentIndex: this.currentIndex,
|
|
9234
|
+
preIndex: this._preIndex,
|
|
9235
|
+
sliding: this._sliding,
|
|
9236
|
+
frameCount: this.frameCount
|
|
9237
|
+
});
|
|
9155
9238
|
|
|
9156
9239
|
if (this.frameCount <= 0) return;
|
|
9157
9240
|
if (this.frameCount <= 1) {
|
|
@@ -9168,7 +9251,10 @@ var slideMixin = {
|
|
|
9168
9251
|
}
|
|
9169
9252
|
}
|
|
9170
9253
|
|
|
9171
|
-
if (this._sliding)
|
|
9254
|
+
if (this._sliding) {
|
|
9255
|
+
__renderLog('[weex-slider] _smoothSlideTo return: already sliding (stuck?)');
|
|
9256
|
+
return;
|
|
9257
|
+
}
|
|
9172
9258
|
this._sliding = true;
|
|
9173
9259
|
|
|
9174
9260
|
var inner = this.$refs.inner;
|
|
@@ -9287,15 +9373,21 @@ var slideMixin = {
|
|
|
9287
9373
|
|
|
9288
9374
|
this$1._sliding = false;
|
|
9289
9375
|
|
|
9290
|
-
//
|
|
9291
|
-
|
|
9376
|
+
// 先同步内部 index,再派发 change,避免外部 :index 回写触发 watch→_slideTo 闪动
|
|
9377
|
+
var prevIndex = this$1._preIndex;
|
|
9378
|
+
this$1.currentIndex = newIndex;
|
|
9379
|
+
this$1._preIndex = newIndex;
|
|
9380
|
+
__renderLog('[weex-slider] _smoothSlideTo done, sync before change', {
|
|
9381
|
+
prevIndex: prevIndex,
|
|
9382
|
+
newIndex: newIndex,
|
|
9383
|
+
sliding: this$1._sliding
|
|
9384
|
+
});
|
|
9385
|
+
if (newIndex !== prevIndex) {
|
|
9292
9386
|
weex.utils.dispatchNativeEvent(this$1.$el, 'change', {
|
|
9293
9387
|
index: newIndex
|
|
9294
9388
|
});
|
|
9295
9389
|
}
|
|
9296
9390
|
|
|
9297
|
-
this$1.currentIndex = newIndex;
|
|
9298
|
-
this$1._preIndex = newIndex;
|
|
9299
9391
|
this$1._emitScrollEvent('scrollend');
|
|
9300
9392
|
}, duration * 1000);
|
|
9301
9393
|
},
|
|
@@ -9390,18 +9482,31 @@ var slider$1 = {
|
|
|
9390
9482
|
|
|
9391
9483
|
watch: {
|
|
9392
9484
|
index: function index () {
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9485
|
+
var normalized = this._normalizeIndex(this.index);
|
|
9486
|
+
__renderLog('[weex-slider] watch index', {
|
|
9487
|
+
propIndex: this.index,
|
|
9488
|
+
normalized: normalized,
|
|
9489
|
+
currentIndex: this.currentIndex,
|
|
9490
|
+
preIndex: this._preIndex,
|
|
9491
|
+
sliding: this._sliding
|
|
9492
|
+
});
|
|
9493
|
+
// 已与内部状态一致:手势/内部 change 回写,跳过二次 _slideTo
|
|
9494
|
+
if (normalized === Number(this.currentIndex) && normalized === Number(this._preIndex)) {
|
|
9495
|
+
__renderLog('[weex-slider] watch index skip: already at target');
|
|
9496
|
+
return;
|
|
9497
|
+
}
|
|
9498
|
+
this.currentIndex = normalized;
|
|
9499
|
+
// 如果正在滑动,强制打断并重置状态(仅外部真正切到不同页时)
|
|
9500
|
+
if (this._sliding) {
|
|
9501
|
+
__renderLog('[weex-slider] watch index interrupt sliding');
|
|
9502
|
+
var inner = this.$refs.inner;
|
|
9503
|
+
if (inner) {
|
|
9504
|
+
inner.style.transition = 'none';
|
|
9404
9505
|
}
|
|
9506
|
+
this._sliding = false;
|
|
9507
|
+
}
|
|
9508
|
+
this._slideTo(this.currentIndex);
|
|
9509
|
+
}
|
|
9405
9510
|
},
|
|
9406
9511
|
|
|
9407
9512
|
data: function data () {
|
|
@@ -11492,7 +11597,7 @@ var dom = {
|
|
|
11492
11597
|
addRule: function (key, styles) {
|
|
11493
11598
|
const rule_key = styles["fontFamily"] + styles["src"]
|
|
11494
11599
|
if (AddedRules[rule_key]) {
|
|
11495
|
-
|
|
11600
|
+
__renderLog("已经添加过字体了,无需再添加", styles.src)
|
|
11496
11601
|
return
|
|
11497
11602
|
}
|
|
11498
11603
|
|
package/package.json
CHANGED