@dolphinweex/weex-vue-render 0.2.27 → 0.2.29
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 +197 -114
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -5930,7 +5930,7 @@ var scrollable$1 = {
|
|
|
5930
5930
|
this._loadmoreReset = false;
|
|
5931
5931
|
var el = this.$el;
|
|
5932
5932
|
if (el) {
|
|
5933
|
-
weex.utils.dispatchNativeEvent(el, '
|
|
5933
|
+
weex.utils.dispatchNativeEvent(el, 'loading');
|
|
5934
5934
|
}
|
|
5935
5935
|
}
|
|
5936
5936
|
}
|
|
@@ -6909,7 +6909,7 @@ function getLoading () {
|
|
|
6909
6909
|
height: function height (val) {
|
|
6910
6910
|
var offset = val + "px";
|
|
6911
6911
|
this.$el.style.height = offset;
|
|
6912
|
-
this.$el.style.bottom =
|
|
6912
|
+
this.$el.style.bottom = 0;
|
|
6913
6913
|
},
|
|
6914
6914
|
display: function display (val) {
|
|
6915
6915
|
if (val === 'hide') {
|
|
@@ -7353,7 +7353,7 @@ var recycleList = {
|
|
|
7353
7353
|
}
|
|
7354
7354
|
};
|
|
7355
7355
|
|
|
7356
|
-
__$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\nbody > .weex-list,\nbody > .weex-recycle,\nbody > .weex-scroller,\nbody > .weex-waterfall {\n max-height: 100%;\n}\n\n.weex-list-wrapper,\n.weex-recycle-wrapper,\n.weex-scroller-wrapper,\n.weex-waterfall-wrapper {\n -webkit-overflow-scrolling: touch;\n}\n\n.weex-list-wrapper,\n.weex-waterfall-wrapper, \n.weex-recycle-wrapper {\n overflow-y: scroll !important;\n overflow-x: hidden !important;\n
|
|
7356
|
+
__$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\nbody > .weex-list,\nbody > .weex-recycle,\nbody > .weex-scroller,\nbody > .weex-waterfall {\n max-height: 100%;\n}\n\n.weex-list-wrapper,\n.weex-recycle-wrapper,\n.weex-scroller-wrapper,\n.weex-waterfall-wrapper {\n -webkit-overflow-scrolling: touch;\n}\n\n.weex-list-wrapper,\n.weex-waterfall-wrapper, \n.weex-recycle-wrapper {\n overflow-y: scroll !important;\n overflow-x: hidden !important;\n justify-content: flex-start !important;\n max-width: 100vw; \n}\n\n.weex-list-inner,\n.weex-recycle-inner,\n.weex-scroller-inner,\n.weex-waterfall-inner {\n -webkit-overflow-scrolling: touch;\n align-items: inherit; \n flex:1; \n}\n\n.weex-waterfall-inner-columns { \n -webkit-flex-direction: row;\n flex-direction: row;\n -webkit-box-orient: horizontal;\n max-width: 100vw; \n}\n\n.weex-scroller-wrapper.weex-scroller-vertical,\n.weex-recycle-wrapper.weex-recycle-vertical {\n overflow-x: hidden;\n overflow-y: scroll;\n}\n\n.weex-scroller-wrapper.weex-scroller-horizontal,\n.weex-recycle-wrapper.weex-recycle-horizontal {\n overflow-x: scroll;\n overflow-y: hidden;\n}\n\n.weex-scroller-wrapper.weex-scroller-disabled {\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n.weex-slider-wrapper.weex-slider-disabled {\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n.weex-list-wrapper.weex-list-disabled {\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n.weex-recycle-wrapper.weex-recycle-disabled {\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n}\n\n.weex-scroller-horizontal .weex-scroller-inner,\n.weex-recycle-horizontal .weex-recycle-inner {\n -webkit-flex-direction: row;\n flex-direction: row;\n -webkit-box-orient: horizontal;\n height: 100%;\n}\n\n.weex-cell {\n width: 100%;\n}\n\n.weex-refresh,\n.weex-loading {\n -webkit-box-align: center;\n -webkit-align-items: center;\n align-items: center;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n justify-content: center;\n width: 100%;\n overflow: hidden;\n}\n",undefined);
|
|
7357
7357
|
|
|
7358
7358
|
/*
|
|
7359
7359
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@@ -7443,7 +7443,6 @@ var slideMixin = {
|
|
|
7443
7443
|
this._clones = [];
|
|
7444
7444
|
this.innerOffset = 0;
|
|
7445
7445
|
this._indicator = null;
|
|
7446
|
-
this.cloneIndex = 0 //需要减或者加去克隆下标
|
|
7447
7446
|
},
|
|
7448
7447
|
|
|
7449
7448
|
beforeUpdate: function beforeUpdate () {
|
|
@@ -7499,7 +7498,7 @@ var slideMixin = {
|
|
|
7499
7498
|
|
|
7500
7499
|
mounted: function mounted () {
|
|
7501
7500
|
this._getWrapperSize();
|
|
7502
|
-
this._slideTo(this.currentIndex
|
|
7501
|
+
this._slideTo(this.currentIndex);
|
|
7503
7502
|
weex.utils.fireLazyload(this.$el, true);
|
|
7504
7503
|
},
|
|
7505
7504
|
|
|
@@ -7532,34 +7531,11 @@ var slideMixin = {
|
|
|
7532
7531
|
}, [vnode])
|
|
7533
7532
|
});
|
|
7534
7533
|
|
|
7535
|
-
|
|
7536
|
-
// 克隆第一个和最后一个有效节点
|
|
7537
|
-
const cloneFirst = () => {
|
|
7538
|
-
const first = cells[0];
|
|
7539
|
-
return first ? createElement('li', {
|
|
7540
|
-
staticClass: "weex-slider-cell weex-ct clone-cell",
|
|
7541
|
-
key: 'clone-first'
|
|
7542
|
-
}, [first.children || first.componentOptions.children]) : null
|
|
7543
|
-
};
|
|
7544
|
-
|
|
7545
|
-
const cloneLast = () => {
|
|
7546
|
-
const last = cells[cells.length - 1];
|
|
7547
|
-
return last ? createElement('li', {
|
|
7548
|
-
staticClass: "weex-slider-cell weex-ct clone-cell",
|
|
7549
|
-
key: 'clone-last'
|
|
7550
|
-
}, [last.children || last.componentOptions.children]) : null
|
|
7551
|
-
};
|
|
7552
|
-
const lastClone = cloneLast();
|
|
7553
|
-
const firstClone = cloneFirst();
|
|
7554
|
-
|
|
7555
|
-
if (firstClone && lastClone) {
|
|
7556
|
-
cells = [lastClone].concat(cells).concat([firstClone]);
|
|
7557
|
-
}
|
|
7558
|
-
}
|
|
7534
|
+
|
|
7559
7535
|
if (indicatorVnode) {
|
|
7560
7536
|
indicatorVnode.data.attrs = indicatorVnode.data.attrs || {};
|
|
7561
7537
|
indicatorVnode.data.attrs.count = cells.length - (this.infinite ? 2 : 0 ); // 显示实际数量
|
|
7562
|
-
indicatorVnode.data.attrs.active = this.currentIndex
|
|
7538
|
+
indicatorVnode.data.attrs.active = this.currentIndex ;
|
|
7563
7539
|
this._indicator = indicatorVnode;
|
|
7564
7540
|
}
|
|
7565
7541
|
return cells
|
|
@@ -7568,7 +7544,6 @@ var slideMixin = {
|
|
|
7568
7544
|
_renderSlides: function _renderSlides (createElement) {
|
|
7569
7545
|
this._cells = this._formatChildren(createElement);
|
|
7570
7546
|
this.frameCount = this._cells.length;
|
|
7571
|
-
this.cloneIndex = this.frameCount > 1 ? Boolean(this.infinite) : 0 //需要减或者加去克隆下标
|
|
7572
7547
|
return createElement(
|
|
7573
7548
|
'nav',
|
|
7574
7549
|
{
|
|
@@ -7621,16 +7596,23 @@ var slideMixin = {
|
|
|
7621
7596
|
|
|
7622
7597
|
_slideTo: function _slideTo(index, isTouchScroll) {
|
|
7623
7598
|
var this$1 = this;
|
|
7624
|
-
|
|
7625
7599
|
if (this.frameCount <= 0) {
|
|
7626
7600
|
return;
|
|
7627
7601
|
}
|
|
7602
|
+
//一张图片无需滚动操作
|
|
7603
|
+
if (this.frameCount <= 1) {
|
|
7604
|
+
this.currentIndex = 0;
|
|
7605
|
+
this._preIndex = 0;
|
|
7606
|
+
return;
|
|
7607
|
+
}
|
|
7608
|
+
// 非无限轮播的边界处理
|
|
7628
7609
|
if (!this.infinite || this.infinite === 'false') {
|
|
7629
7610
|
if (index === -1 || index > (this.frameCount - 1)) {
|
|
7630
7611
|
this._slideTo(this.currentIndex);
|
|
7631
7612
|
return;
|
|
7632
7613
|
}
|
|
7633
7614
|
}
|
|
7615
|
+
|
|
7634
7616
|
if (!this._preIndex && this._preIndex !== 0) {
|
|
7635
7617
|
this._preIndex = this.currentIndex || 0;
|
|
7636
7618
|
}
|
|
@@ -7640,98 +7622,163 @@ var slideMixin = {
|
|
|
7640
7622
|
}
|
|
7641
7623
|
this._sliding = true;
|
|
7642
7624
|
|
|
7643
|
-
var newIndex = this._normalizeIndex(index);
|
|
7644
7625
|
var inner = this.$refs.inner;
|
|
7645
7626
|
var step = this._step = this.frameCount <= 1 ? 0 : this._preIndex - index;
|
|
7646
7627
|
|
|
7647
7628
|
if (inner) {
|
|
7648
7629
|
this._prepareNodes();
|
|
7649
|
-
var
|
|
7650
|
-
var match = translate && translate.match(/translate[^(]+\(([+-\d.]+)/);
|
|
7651
|
-
var innerX = parseFloat(inner.style.left);
|
|
7630
|
+
var innerX = parseFloat(inner.style.left) || 0;
|
|
7652
7631
|
var dist = innerX - this.innerOffset + step;
|
|
7653
|
-
this.innerOffset += step * this._wrapperWidth;
|
|
7654
7632
|
|
|
7655
|
-
//
|
|
7656
|
-
if (this.
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7633
|
+
// 处理无限轮播的边界情况 将目标元素先定位到目的地 动画结束后再回归原位
|
|
7634
|
+
if (this.infinite && this.infinite !== 'false') {
|
|
7635
|
+
if (index < 0) {
|
|
7636
|
+
// 从第一张向左滑
|
|
7637
|
+
var lastIndex = this.frameCount - 1;
|
|
7638
|
+
|
|
7639
|
+
// 先将最后一张放到左侧
|
|
7640
|
+
var lastNode = this._cells[lastIndex].elm;
|
|
7641
|
+
lastNode.style.position = 'absolute';
|
|
7642
|
+
lastNode.style.left = `-${this._wrapperWidth}px`;
|
|
7643
|
+
lastNode.style.opacity = '1';
|
|
7644
|
+
lastNode.style.zIndex = '10';
|
|
7645
|
+
// 执行向左滑动动画
|
|
7660
7646
|
inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
|
|
7647
|
+
this.innerOffset += this._wrapperWidth;
|
|
7661
7648
|
inner.style.left = `${this.innerOffset}px`;
|
|
7662
|
-
newIndex = 1; // 视觉上显示 `第一张`
|
|
7663
7649
|
|
|
7664
|
-
|
|
7650
|
+
// 动画结束后第一张在充值回原先位置
|
|
7665
7651
|
setTimeout(() => {
|
|
7666
7652
|
inner.style.transition = 'none';
|
|
7667
|
-
|
|
7653
|
+
lastNode.style.position = '';
|
|
7654
|
+
lastNode.style.left = '';
|
|
7655
|
+
this.innerOffset = -lastIndex * this._wrapperWidth;
|
|
7668
7656
|
inner.style.left = `${this.innerOffset}px`;
|
|
7657
|
+
|
|
7658
|
+
setTimeout(() => {
|
|
7659
|
+
inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
|
|
7660
|
+
}, 50);
|
|
7669
7661
|
}, TRANSITION_TIME);
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7662
|
+
|
|
7663
|
+
index = lastIndex;
|
|
7664
|
+
} else if (index >= this.frameCount) {
|
|
7665
|
+
// 从最后一张向右滑
|
|
7666
|
+
// 克隆第一张图片并放置在适当位置
|
|
7667
|
+
var firstNode = this._cells[0].elm;
|
|
7668
|
+
var cloneNode = firstNode.cloneNode(true);
|
|
7669
|
+
cloneNode.style.position = 'absolute';
|
|
7670
|
+
cloneNode.style.left = `${this.frameCount * this._wrapperWidth}px`;
|
|
7671
|
+
cloneNode.style.width = `${this._wrapperWidth}px`;
|
|
7672
|
+
cloneNode.style.zIndex = '10';
|
|
7673
|
+
inner.appendChild(cloneNode);
|
|
7674
|
+
|
|
7675
|
+
// 执行向右滑动动画
|
|
7674
7676
|
inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
|
|
7677
|
+
this.innerOffset -= this._wrapperWidth;
|
|
7675
7678
|
inner.style.left = `${this.innerOffset}px`;
|
|
7676
|
-
newIndex = this.frameCount - 2; // 视觉上显示 `最后一张`
|
|
7677
7679
|
|
|
7678
|
-
|
|
7680
|
+
// 动画结束后重置位置
|
|
7679
7681
|
setTimeout(() => {
|
|
7682
|
+
// 移除过渡效果
|
|
7680
7683
|
inner.style.transition = 'none';
|
|
7681
|
-
|
|
7682
|
-
|
|
7684
|
+
|
|
7685
|
+
// 移除克隆节点
|
|
7686
|
+
if (cloneNode.parentNode) {
|
|
7687
|
+
inner.removeChild(cloneNode);
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7690
|
+
// 重置位置到第一张
|
|
7691
|
+
this.innerOffset = 0;
|
|
7692
|
+
inner.style.left = '0px';
|
|
7693
|
+
|
|
7694
|
+
// 短暂延迟后恢复过渡效果
|
|
7695
|
+
setTimeout(() => {
|
|
7696
|
+
inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
|
|
7697
|
+
}, 50);
|
|
7683
7698
|
}, TRANSITION_TIME);
|
|
7684
7699
|
|
|
7700
|
+
index = 0;
|
|
7685
7701
|
} else {
|
|
7686
7702
|
// 正常切换
|
|
7687
|
-
|
|
7703
|
+
this.innerOffset = -index * this._wrapperWidth;
|
|
7704
|
+
inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
|
|
7705
|
+
inner.style.left = `${this.innerOffset}px`;
|
|
7706
|
+
}
|
|
7707
|
+
} else {
|
|
7708
|
+
// 非无限轮播的正常切换
|
|
7709
|
+
this.innerOffset = -index * this._wrapperWidth;
|
|
7688
7710
|
inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
|
|
7689
7711
|
inner.style.left = `${this.innerOffset}px`;
|
|
7690
7712
|
}
|
|
7691
7713
|
|
|
7692
|
-
//
|
|
7714
|
+
// 触发滚动事件
|
|
7693
7715
|
if (!isTouchScroll) {
|
|
7694
7716
|
this._emitScrollEvent('scrollstart');
|
|
7695
7717
|
}
|
|
7696
|
-
|
|
7697
|
-
|
|
7718
|
+
|
|
7719
|
+
setTimeout(() => {
|
|
7720
|
+
this$1._throttleEmitScroll(dist, () => {
|
|
7698
7721
|
this$1._emitScrollEvent('scrollend');
|
|
7699
7722
|
});
|
|
7700
7723
|
}, THROTTLE_SCROLL_TIME);
|
|
7701
7724
|
|
|
7702
7725
|
this._loopShowNodes(step);
|
|
7703
7726
|
|
|
7704
|
-
setTimeout(
|
|
7727
|
+
setTimeout(() => {
|
|
7705
7728
|
if (this$1.isNeighbor) {
|
|
7706
7729
|
this$1._setNeighbors();
|
|
7707
7730
|
}
|
|
7708
7731
|
|
|
7709
|
-
setTimeout(
|
|
7710
|
-
inner.style.webkitTransition = '';
|
|
7711
|
-
inner.style.mozTransition = '';
|
|
7732
|
+
setTimeout(() => {
|
|
7712
7733
|
inner.style.transition = '';
|
|
7713
7734
|
for (var i = this$1._showStartIdx; i <= this$1._showEndIdx; i++) {
|
|
7714
7735
|
var node = this$1._showNodes[i];
|
|
7715
|
-
if (!node)
|
|
7736
|
+
if (!node) continue;
|
|
7716
7737
|
var elm = node.firstElementChild;
|
|
7717
|
-
if (!elm)
|
|
7718
|
-
elm.style.webkitTransition = '';
|
|
7719
|
-
elm.style.mozTransition = '';
|
|
7738
|
+
if (!elm) continue;
|
|
7720
7739
|
elm.style.transition = '';
|
|
7721
7740
|
}
|
|
7722
|
-
this$1._rearrangeNodes(
|
|
7741
|
+
this$1._rearrangeNodes(index);
|
|
7723
7742
|
}, NEIGHBOR_SCALE_TIME);
|
|
7724
7743
|
}, TRANSITION_TIME);
|
|
7725
7744
|
}
|
|
7726
7745
|
|
|
7727
|
-
if (
|
|
7746
|
+
if (index !== this._preIndex) {
|
|
7728
7747
|
weex.utils.dispatchNativeEvent(this.$el, 'change', {
|
|
7729
|
-
index:
|
|
7748
|
+
index: index
|
|
7730
7749
|
});
|
|
7731
7750
|
}
|
|
7751
|
+
|
|
7752
|
+
this.currentIndex = index;
|
|
7753
|
+
this._preIndex = index;
|
|
7754
|
+
},
|
|
7755
|
+
// 优化_prepareNodes方法以支持无缝切换
|
|
7756
|
+
_prepareNodes: function _prepareNodes() {
|
|
7757
|
+
var step = this._step;
|
|
7758
|
+
if (!this._inited) {
|
|
7759
|
+
this._initNodes();
|
|
7760
|
+
this._inited = true;
|
|
7761
|
+
this._showNodes = {};
|
|
7762
|
+
}
|
|
7732
7763
|
|
|
7733
|
-
this.
|
|
7734
|
-
|
|
7764
|
+
if (this.frameCount <= 1) {
|
|
7765
|
+
this._showStartIdx = this._showEndIdx = 0;
|
|
7766
|
+
var node = this._cells[0].elm;
|
|
7767
|
+
node.style.opacity = 1;
|
|
7768
|
+
node.index = 0;
|
|
7769
|
+
this._showNodes[0] = node;
|
|
7770
|
+
node._inShow = true;
|
|
7771
|
+
node._showIndex = 0;
|
|
7772
|
+
return;
|
|
7773
|
+
}
|
|
7774
|
+
|
|
7775
|
+
// 计算需要显示的节点范围,确保边界切换时有足够的节点
|
|
7776
|
+
var showCount = this._showCount = Math.abs(step) + 3;
|
|
7777
|
+
this._showStartIdx = step <= 0 ? -1 : 2 - showCount;
|
|
7778
|
+
this._showEndIdx = step <= 0 ? showCount - 2 : 1;
|
|
7779
|
+
|
|
7780
|
+
this._clearNodesOffset();
|
|
7781
|
+
this._positionNodes(this._showStartIdx, this._showEndIdx, step);
|
|
7735
7782
|
},
|
|
7736
7783
|
|
|
7737
7784
|
_clearNodesOffset: function _clearNodesOffset () {
|
|
@@ -7769,31 +7816,32 @@ var slideMixin = {
|
|
|
7769
7816
|
this._showEndIdx += step;
|
|
7770
7817
|
},
|
|
7771
7818
|
|
|
7772
|
-
_prepareNodes: function _prepareNodes
|
|
7773
|
-
// test if the next slide towards the direction exists.
|
|
7774
|
-
// e.g. currentIndex 0 -> 1: should prepare 4 slides: -1, 0, 1, 2
|
|
7775
|
-
// if not, translate a node to here, or just clone it.
|
|
7819
|
+
_prepareNodes: function _prepareNodes() {
|
|
7776
7820
|
var step = this._step;
|
|
7777
7821
|
if (!this._inited) {
|
|
7778
7822
|
this._initNodes();
|
|
7779
7823
|
this._inited = true;
|
|
7780
7824
|
this._showNodes = {};
|
|
7781
7825
|
}
|
|
7826
|
+
|
|
7827
|
+
// 单张图片特殊处理
|
|
7782
7828
|
if (this.frameCount <= 1) {
|
|
7783
7829
|
this._showStartIdx = this._showEndIdx = 0;
|
|
7784
7830
|
var node = this._cells[0].elm;
|
|
7785
7831
|
node.style.opacity = 1;
|
|
7786
|
-
// node.style.zIndex = 99;
|
|
7787
7832
|
node.index = 0;
|
|
7788
7833
|
this._showNodes[0] = node;
|
|
7789
7834
|
node._inShow = true;
|
|
7790
7835
|
node._showIndex = 0;
|
|
7791
|
-
return
|
|
7836
|
+
return;
|
|
7792
7837
|
}
|
|
7793
7838
|
|
|
7839
|
+
// 计算需要显示的节点范围
|
|
7794
7840
|
var showCount = this._showCount = Math.abs(step) + 3;
|
|
7795
7841
|
this._showStartIdx = step <= 0 ? -1 : 2 - showCount;
|
|
7796
7842
|
this._showEndIdx = step <= 0 ? showCount - 2 : 1;
|
|
7843
|
+
|
|
7844
|
+
// 清理并更新节点位置
|
|
7797
7845
|
this._clearNodesOffset();
|
|
7798
7846
|
this._positionNodes(this._showStartIdx, this._showEndIdx, step);
|
|
7799
7847
|
},
|
|
@@ -8071,7 +8119,7 @@ var slideMixin = {
|
|
|
8071
8119
|
},
|
|
8072
8120
|
|
|
8073
8121
|
_handleTouchStart: function _handleTouchStart (event) {
|
|
8074
|
-
if (!this.scrollable) {
|
|
8122
|
+
if (!this.scrollable || this.frameCount<=1) {
|
|
8075
8123
|
return // 🚫 禁止滚动行为
|
|
8076
8124
|
}
|
|
8077
8125
|
var touch = event.changedTouches[0];
|
|
@@ -8116,7 +8164,41 @@ var slideMixin = {
|
|
|
8116
8164
|
if (isV) {
|
|
8117
8165
|
return
|
|
8118
8166
|
}
|
|
8119
|
-
|
|
8167
|
+
// 判断是否到达边界,决定是否放行事件
|
|
8168
|
+
const isLeftSwipe = offsetX < 0;
|
|
8169
|
+
const isRightSwipe = offsetX > 0;
|
|
8170
|
+
const atFirst = this._preIndex === 0;
|
|
8171
|
+
const atLast = this._preIndex === this.frameCount - 1;
|
|
8172
|
+
//修改自动轮播或者无缝轮播边界滚动的过渡动画
|
|
8173
|
+
if (this.infinite && this.infinite !== 'false') {
|
|
8174
|
+
var inner = this.$refs.inner;
|
|
8175
|
+
if (inner && ((atFirst && isRightSwipe) || (atLast && isLeftSwipe))) {
|
|
8176
|
+
if (!tp.boundaryHandled) {
|
|
8177
|
+
tp.boundaryHandled = true;
|
|
8178
|
+
if (atFirst && isRightSwipe) {
|
|
8179
|
+
// 从第一张向右滑到最后一张
|
|
8180
|
+
var lastIndex = this.frameCount - 1;
|
|
8181
|
+
var lastNode = this._cells[lastIndex].elm;
|
|
8182
|
+
lastNode.style.position = 'absolute';
|
|
8183
|
+
lastNode.style.left = `-${this._wrapperWidth}px`;
|
|
8184
|
+
lastNode.style.opacity = '1';
|
|
8185
|
+
} else if (atLast && isLeftSwipe) {
|
|
8186
|
+
// 从最后一张向左滑到第一张
|
|
8187
|
+
var firstNode = this._cells[0].elm;
|
|
8188
|
+
var cloneNode = firstNode.cloneNode(true);
|
|
8189
|
+
cloneNode.style.position = 'absolute';
|
|
8190
|
+
cloneNode.style.left = `${this.frameCount * this._wrapperWidth}px`;
|
|
8191
|
+
cloneNode.style.width = `${this._wrapperWidth}px`;
|
|
8192
|
+
inner.appendChild(cloneNode);
|
|
8193
|
+
tp.cloneNode = cloneNode;
|
|
8194
|
+
}
|
|
8195
|
+
}
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
if (!this.infinite && !this.autoPlay && ((atLast && isLeftSwipe) || (atFirst && isRightSwipe))) {
|
|
8199
|
+
// ✅ 如果是边界并继续滑动,就放手,不拦截
|
|
8200
|
+
return;
|
|
8201
|
+
}
|
|
8120
8202
|
if (this._sliding) {
|
|
8121
8203
|
event.stopPropagation();
|
|
8122
8204
|
return
|
|
@@ -8134,7 +8216,7 @@ var slideMixin = {
|
|
|
8134
8216
|
|
|
8135
8217
|
touchSliderInstance = inner;
|
|
8136
8218
|
|
|
8137
|
-
if (!this.autoPlay) {
|
|
8219
|
+
if (!this.autoPlay && !this.infinite) {
|
|
8138
8220
|
// 如果不是自动播放,则当滚动到最后一页时,offsetX不能 < 0
|
|
8139
8221
|
// 如果不是自动播放,则当滚动到第一页时,offsetX不能 > 0
|
|
8140
8222
|
if (this._preIndex == this.frameCount - 1) {
|
|
@@ -8273,6 +8355,7 @@ var slider$1 = {
|
|
|
8273
8355
|
watch: {
|
|
8274
8356
|
index: function index () {
|
|
8275
8357
|
this.currentIndex = this._normalizeIndex(this.index);
|
|
8358
|
+
console.log('cdj----index',this.infinite,this.currentIndex)
|
|
8276
8359
|
}
|
|
8277
8360
|
},
|
|
8278
8361
|
|
|
@@ -10041,49 +10124,49 @@ function detectEvents () {
|
|
|
10041
10124
|
detectEvents();
|
|
10042
10125
|
|
|
10043
10126
|
function transitionOnce (vnode, config, callback) {
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10127
|
+
var nextFrame = utils$2.nextFrame;
|
|
10128
|
+
var toCSSText = utils$2.toCSSText;
|
|
10129
|
+
var styleObject2rem = utils$2.styleObject2rem;
|
|
10130
|
+
var isArray = utils$2.isArray;
|
|
10048
10131
|
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10132
|
+
if (isArray(vnode)) {
|
|
10133
|
+
vnode = vnode[0];
|
|
10134
|
+
}
|
|
10052
10135
|
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10136
|
+
var duration = config.duration || 100; // ms
|
|
10137
|
+
var timing = config.timingFunction || 'linear';
|
|
10138
|
+
var delay = config.delay || 0; // ms
|
|
10056
10139
|
|
|
10057
|
-
|
|
10058
|
-
|
|
10140
|
+
// TODO: parse transition properties
|
|
10141
|
+
var transitionValue = "all " + duration + "ms " + timing + " " + delay + "ms";
|
|
10059
10142
|
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10143
|
+
var dom = vnode instanceof HTMLElement ? vnode : vnode.$el;
|
|
10144
|
+
// trigger image lazyloading by force.
|
|
10145
|
+
dom && weex.utils.fireLazyload(dom, true);
|
|
10063
10146
|
|
|
10064
|
-
|
|
10065
|
-
|
|
10147
|
+
var transitionEndHandler = function (event) {
|
|
10148
|
+
event && event.stopPropagation();
|
|
10149
|
+
if (endEvent) {
|
|
10150
|
+
dom.removeEventListener(endEvent, transitionEndHandler);
|
|
10151
|
+
dom.style[styleName] = '';
|
|
10152
|
+
}
|
|
10153
|
+
setTimeout(()=>{
|
|
10154
|
+
callback(); //解决嵌套animation的时候 duration过小时会出现瞬间执行完毕的问题
|
|
10155
|
+
})
|
|
10156
|
+
};
|
|
10066
10157
|
if (endEvent) {
|
|
10067
|
-
dom.
|
|
10068
|
-
|
|
10069
|
-
}
|
|
10070
|
-
setTimeout(()=>{
|
|
10071
|
-
callback(); //解决嵌套animation的时候 duration过小时会出现瞬间执行完毕的问题
|
|
10072
|
-
})
|
|
10073
|
-
};
|
|
10074
|
-
if (endEvent) {
|
|
10075
|
-
dom.style[styleName] = transitionValue;
|
|
10076
|
-
dom.addEventListener(endEvent, transitionEndHandler);
|
|
10077
|
-
}
|
|
10078
|
-
nextFrame(function () {
|
|
10079
|
-
// 修改 transform:translate让它支持传3个参数,且第三个参数无效
|
|
10080
|
-
if (config.styles["transform"]) {
|
|
10081
|
-
config.styles["transform"] = config.styles["transform"].replace(/(translate\([^,]+,[^,]+),[^)]+\)/, '$1)')
|
|
10158
|
+
dom.style[styleName] = transitionValue;
|
|
10159
|
+
dom.addEventListener(endEvent, transitionEndHandler);
|
|
10082
10160
|
}
|
|
10161
|
+
nextFrame(function () {
|
|
10162
|
+
// 修改 transform:translate让它支持传3个参数,且第三个参数无效
|
|
10163
|
+
if (config.styles["transform"]) {
|
|
10164
|
+
config.styles["transform"] = config.styles["transform"].replace(/(translate\([^,]+,[^,]+),[^)]+\)/, '$1)')
|
|
10165
|
+
}
|
|
10083
10166
|
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10167
|
+
dom.style.cssText
|
|
10168
|
+
+= toCSSText(styleObject2rem(config.styles, DESIGN_ROOT_VALUE) || {});
|
|
10169
|
+
});
|
|
10087
10170
|
}
|
|
10088
10171
|
|
|
10089
10172
|
var animation = {
|
package/package.json
CHANGED