@dolphinweex/weex-vue-render 0.2.89 → 0.2.91
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 +87 -34
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -4081,6 +4081,7 @@ function initEnv (viewportInfo, envInfo) {
|
|
|
4081
4081
|
deviceModel: device_display.deviceModel || "",
|
|
4082
4082
|
appEnv: device_display.appEnv,
|
|
4083
4083
|
versionCode: device_display.versionCode,
|
|
4084
|
+
colmoVersion: device_display.colmoVersion,
|
|
4084
4085
|
idfa: device_display.idfa,
|
|
4085
4086
|
isFullScreen: device_display.isFullScreen,
|
|
4086
4087
|
weexVersion: device_display.weexVersion,
|
|
@@ -5693,12 +5694,15 @@ function getImage(weex) {
|
|
|
5693
5694
|
return {
|
|
5694
5695
|
data: function data() {
|
|
5695
5696
|
return {
|
|
5696
|
-
locationSrc:'',
|
|
5697
|
+
locationSrc: '',
|
|
5698
|
+
currentSrc: '',
|
|
5699
|
+
isLoaded: false,
|
|
5697
5700
|
}
|
|
5698
5701
|
},
|
|
5699
5702
|
name: 'weex-image',
|
|
5700
5703
|
props: {
|
|
5701
5704
|
src: String,
|
|
5705
|
+
placeholder: String,
|
|
5702
5706
|
saveImg: {
|
|
5703
5707
|
type: [String],
|
|
5704
5708
|
default: "",
|
|
@@ -5721,18 +5725,22 @@ function getImage(weex) {
|
|
|
5721
5725
|
},
|
|
5722
5726
|
methods: {
|
|
5723
5727
|
loadImage: function loadImage() {
|
|
5724
|
-
// 检查src是否有效
|
|
5725
5728
|
if (!this.src || this.src === 'undefined' || this.src === '') {
|
|
5729
|
+
this.currentSrc = this.placeholder || '';
|
|
5730
|
+
this.isLoaded = false;
|
|
5726
5731
|
this.$emit("error", {
|
|
5727
5732
|
success: false,
|
|
5728
5733
|
message: 'Invalid image source'
|
|
5729
5734
|
});
|
|
5730
5735
|
return;
|
|
5731
5736
|
}
|
|
5732
|
-
|
|
5737
|
+
this.currentSrc = this.placeholder || '';
|
|
5738
|
+
this.isLoaded = false;
|
|
5733
5739
|
const img = new Image();
|
|
5734
5740
|
img.src = this.src;
|
|
5735
5741
|
img.onload = (event) => {
|
|
5742
|
+
this.currentSrc = this.src;
|
|
5743
|
+
this.isLoaded = true;
|
|
5736
5744
|
// 触发load事件并传递参数
|
|
5737
5745
|
this.$emit("load", {
|
|
5738
5746
|
success: true,
|
|
@@ -5743,6 +5751,9 @@ function getImage(weex) {
|
|
|
5743
5751
|
});
|
|
5744
5752
|
};
|
|
5745
5753
|
img.onerror = (event) => {
|
|
5754
|
+
// 加载失败,保持 placeholder 作为缺省图
|
|
5755
|
+
this.currentSrc = this.placeholder || '';
|
|
5756
|
+
this.isLoaded = false;
|
|
5746
5757
|
// 触发error事件并传递参数
|
|
5747
5758
|
this.$emit("error", {
|
|
5748
5759
|
success: false,
|
|
@@ -5882,8 +5893,9 @@ function getImage(weex) {
|
|
|
5882
5893
|
},
|
|
5883
5894
|
|
|
5884
5895
|
render: function render(createElement) {
|
|
5885
|
-
|
|
5886
|
-
|
|
5896
|
+
// 优先显示已解析的 currentSrc(含 placeholder 兜底),fallback 到 src
|
|
5897
|
+
var displaySrc = this.currentSrc || this.checkTrim(this.src);
|
|
5898
|
+
return createElement("figure", {
|
|
5887
5899
|
attrs: {
|
|
5888
5900
|
"weex-type": "img",
|
|
5889
5901
|
src: this.checkTrim(this.src),
|
|
@@ -5896,7 +5908,7 @@ function getImage(weex) {
|
|
|
5896
5908
|
},
|
|
5897
5909
|
staticClass: "weex-image weex-el",
|
|
5898
5910
|
staticStyle: {
|
|
5899
|
-
backgroundImage: `url(${this.checkTrim(
|
|
5911
|
+
backgroundImage: displaySrc ? `url(${this.checkTrim(displaySrc)})` : '',
|
|
5900
5912
|
backgroundSize: this.resize || "stretch",
|
|
5901
5913
|
backgroundRepeat: "no-repeat",
|
|
5902
5914
|
},
|
|
@@ -8171,7 +8183,6 @@ var slideMixin = {
|
|
|
8171
8183
|
lastNode.style.position = 'absolute';
|
|
8172
8184
|
this._setPosition(lastNode, -this._wrapperWidth);
|
|
8173
8185
|
lastNode.style.opacity = '1';
|
|
8174
|
-
lastNode.style.zIndex = '10';
|
|
8175
8186
|
|
|
8176
8187
|
// 执行向左滑动动画
|
|
8177
8188
|
inner.style.transition = slideTranstionTime;
|
|
@@ -8199,7 +8210,6 @@ var slideMixin = {
|
|
|
8199
8210
|
cloneNode.style.position = 'absolute';
|
|
8200
8211
|
this._setPosition(cloneNode, this.frameCount * this._wrapperWidth);
|
|
8201
8212
|
cloneNode.style.width = `${this._wrapperWidth}px`;
|
|
8202
|
-
cloneNode.style.zIndex = '10';
|
|
8203
8213
|
if (!cloneNode.parentNode) {
|
|
8204
8214
|
inner.appendChild(cloneNode);
|
|
8205
8215
|
}
|
|
@@ -8461,6 +8471,14 @@ var slideMixin = {
|
|
|
8461
8471
|
// clone._inShow = origNode._inShow
|
|
8462
8472
|
clone.index = origNode.index;
|
|
8463
8473
|
clone.style.zIndex = 0;
|
|
8474
|
+
// clone 中的 embed 需要保留以维持布局,但必须修改 id 防止触发同层渲染 CREATE 生命周期
|
|
8475
|
+
// (CREATE 会替换原始 embed 的 controller,导致原视频失去 rootNode)
|
|
8476
|
+
// 约定:id 以 "clone_" 开头的 embed 在 SameLayerManager 里会被直接忽略
|
|
8477
|
+
var cloneEmbeds = clone.querySelectorAll('embed');
|
|
8478
|
+
for (var ci = 0; ci < cloneEmbeds.length; ci++) {
|
|
8479
|
+
var origId = cloneEmbeds[ci].getAttribute('id') || '';
|
|
8480
|
+
cloneEmbeds[ci].setAttribute('id', 'native_disabled_' + origId);
|
|
8481
|
+
}
|
|
8464
8482
|
this.$refs.inner.appendChild(clone);
|
|
8465
8483
|
arr.push(clone);
|
|
8466
8484
|
return clone
|
|
@@ -8501,6 +8519,14 @@ var slideMixin = {
|
|
|
8501
8519
|
cloneNode._isClone = true;
|
|
8502
8520
|
cloneNode._originalNode = originalNode;
|
|
8503
8521
|
|
|
8522
|
+
// clone 中的 embed 需要保留以维持布局,但必须修改 id 防止触发同层渲染 CREATE 生命周期
|
|
8523
|
+
// 约定:id 以 "clone_" 开头的 embed 在 SameLayerManager 里会被直接忽略
|
|
8524
|
+
var cloneEmbeds = cloneNode.querySelectorAll('embed');
|
|
8525
|
+
for (var ci = 0; ci < cloneEmbeds.length; ci++) {
|
|
8526
|
+
var origId = cloneEmbeds[ci].getAttribute('id') || '';
|
|
8527
|
+
cloneEmbeds[ci].setAttribute('id', 'native_disabled_' + origId);
|
|
8528
|
+
}
|
|
8529
|
+
|
|
8504
8530
|
// 预设所有图片元素的背景图片,避免重新加载
|
|
8505
8531
|
var originalImages = originalNode.querySelectorAll('[style*="background-image"]');
|
|
8506
8532
|
var clonedImages = cloneNode.querySelectorAll('[style*="background-image"], [data-img-src]');
|
|
@@ -8872,16 +8898,21 @@ var slideMixin = {
|
|
|
8872
8898
|
this._setPosition(lastNode, -this._wrapperWidth);
|
|
8873
8899
|
lastNode.style.opacity = '1';
|
|
8874
8900
|
} else if (atLast && isLeftSwipe) {
|
|
8875
|
-
//
|
|
8901
|
+
// 从最后一张向左滑到第一张:
|
|
8902
|
+
// 第一张在列表开头,不能脱离文档流,否则会导致当前最后一张区域出现黑块。
|
|
8903
|
+
// 这里保留其布局位置,只做视觉位移到最右侧。
|
|
8876
8904
|
var firstNode = this._cells[0].elm;
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
this._setPosition(
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8905
|
+
console.log('cdj-touchmove-last-to-first', { currentIndex: this.currentIndex, preIndex: this._preIndex, frameCount: this.frameCount });
|
|
8906
|
+
firstNode.style.position = this.isTransform ? '' : 'relative';
|
|
8907
|
+
this._setPosition(firstNode, this.frameCount * this._wrapperWidth);
|
|
8908
|
+
firstNode.style.opacity = '1';
|
|
8909
|
+
var firstInner = firstNode.firstElementChild;
|
|
8910
|
+
if (firstInner) {
|
|
8911
|
+
firstInner.style.opacity = '1';
|
|
8912
|
+
firstInner.style.transition = 'none';
|
|
8913
|
+
firstInner.style.transform = '';
|
|
8883
8914
|
}
|
|
8884
|
-
tp.
|
|
8915
|
+
tp.boundaryFirstNode = firstNode;
|
|
8885
8916
|
}
|
|
8886
8917
|
}
|
|
8887
8918
|
}
|
|
@@ -8970,6 +9001,7 @@ var slideMixin = {
|
|
|
8970
9001
|
}
|
|
8971
9002
|
|
|
8972
9003
|
var newIndex = shouldSwitch ? (this.currentIndex - direction) : this.currentIndex;
|
|
9004
|
+
console.log('cdj-touchend-decision', { currentIndex: this.currentIndex, preIndex: this._preIndex, newIndex: newIndex, moveRatio: moveRatio, velocity: this.velocity, shouldSwitch: shouldSwitch, duration: animationDuration });
|
|
8973
9005
|
|
|
8974
9006
|
// 边界检查
|
|
8975
9007
|
if (!this.infinite || this.infinite === 'false') {
|
|
@@ -8979,6 +9011,15 @@ var slideMixin = {
|
|
|
8979
9011
|
|
|
8980
9012
|
// 如果是复位操作(没有切换页面),使用更平滑的动画
|
|
8981
9013
|
if (newIndex === this.currentIndex) {
|
|
9014
|
+
if (tp.boundaryFirstNode) {
|
|
9015
|
+
tp.boundaryFirstNode.style.position = '';
|
|
9016
|
+
tp.boundaryFirstNode.style.zIndex = '';
|
|
9017
|
+
var rollbackInner = tp.boundaryFirstNode.firstElementChild;
|
|
9018
|
+
if (rollbackInner) {
|
|
9019
|
+
rollbackInner.style.transition = '';
|
|
9020
|
+
}
|
|
9021
|
+
this._setPosition(tp.boundaryFirstNode, 0);
|
|
9022
|
+
}
|
|
8982
9023
|
this._smoothResetPosition(inner, animationDuration);
|
|
8983
9024
|
} else {
|
|
8984
9025
|
this._smoothSlideTo(newIndex, animationDuration, moveRatio);
|
|
@@ -9046,8 +9087,9 @@ var slideMixin = {
|
|
|
9046
9087
|
var currentOffset = this._getPosition(inner);
|
|
9047
9088
|
var targetOffset;
|
|
9048
9089
|
var needsReset = false;
|
|
9049
|
-
|
|
9050
|
-
|
|
9090
|
+
var cloneNode = null;
|
|
9091
|
+
var lastNode = null;
|
|
9092
|
+
var firstNode = null;
|
|
9051
9093
|
|
|
9052
9094
|
// 使用更自然的缓动函数
|
|
9053
9095
|
var easing = Math.abs(moveRatio) > 0.4 ?
|
|
@@ -9063,11 +9105,11 @@ var slideMixin = {
|
|
|
9063
9105
|
if (newIndex < 0) {
|
|
9064
9106
|
// 从第一张向右滑到最后一张
|
|
9065
9107
|
newIndex = this.frameCount - 1;
|
|
9108
|
+
console.log('cdj-smooth-boundary-first-to-last', { targetIndex: newIndex, innerOffset: this.innerOffset, wrapperWidth: this._wrapperWidth });
|
|
9066
9109
|
lastNode = this._cells[newIndex].elm;
|
|
9067
9110
|
lastNode.style.position = 'absolute';
|
|
9068
9111
|
this._setPosition(lastNode, -this._wrapperWidth);
|
|
9069
9112
|
lastNode.style.opacity = '1';
|
|
9070
|
-
lastNode.style.zIndex = '10';
|
|
9071
9113
|
|
|
9072
9114
|
// 目标是向右滑动到左侧的最后一张图片
|
|
9073
9115
|
targetOffset = this.innerOffset + this._wrapperWidth;
|
|
@@ -9075,17 +9117,18 @@ var slideMixin = {
|
|
|
9075
9117
|
} else if (newIndex >= this.frameCount) {
|
|
9076
9118
|
// 从最后一张向左滑到第一张
|
|
9077
9119
|
newIndex = 0;
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9120
|
+
firstNode = this._cells[0].elm;
|
|
9121
|
+
firstNode.style.position = this.isTransform ? '' : 'relative';
|
|
9122
|
+
this._setPosition(firstNode, this.frameCount * this._wrapperWidth);
|
|
9123
|
+
firstNode.style.opacity = '1';
|
|
9124
|
+
var smoothFirstInner = firstNode.firstElementChild;
|
|
9125
|
+
if (smoothFirstInner) {
|
|
9126
|
+
smoothFirstInner.style.opacity = '1';
|
|
9127
|
+
smoothFirstInner.style.transition = 'none';
|
|
9128
|
+
smoothFirstInner.style.transform = '';
|
|
9129
|
+
}
|
|
9087
9130
|
|
|
9088
|
-
|
|
9131
|
+
// 目标是向左滑动到右侧的第一张图片
|
|
9089
9132
|
targetOffset = this.innerOffset - this._wrapperWidth;
|
|
9090
9133
|
needsReset = true;
|
|
9091
9134
|
} else {
|
|
@@ -9125,10 +9168,20 @@ var slideMixin = {
|
|
|
9125
9168
|
this$1._setPosition(lastNode, 0);
|
|
9126
9169
|
}
|
|
9127
9170
|
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9171
|
+
if (cloneNode && cloneNode.parentNode) {
|
|
9172
|
+
// 兼容旧逻辑,兜底移除clone
|
|
9173
|
+
inner.removeChild(cloneNode);
|
|
9174
|
+
}
|
|
9175
|
+
if (firstNode) {
|
|
9176
|
+
// 重置第一张图片位置
|
|
9177
|
+
firstNode.style.position = '';
|
|
9178
|
+
firstNode.style.zIndex = '';
|
|
9179
|
+
var resetFirstInner = firstNode.firstElementChild;
|
|
9180
|
+
if (resetFirstInner) {
|
|
9181
|
+
resetFirstInner.style.transition = '';
|
|
9182
|
+
}
|
|
9183
|
+
this$1._setPosition(firstNode, 0);
|
|
9184
|
+
}
|
|
9132
9185
|
|
|
9133
9186
|
// 重置到正确的最终位置
|
|
9134
9187
|
this$1.innerOffset = -newIndex * this$1._wrapperWidth;
|
|
@@ -9154,7 +9207,7 @@ var slideMixin = {
|
|
|
9154
9207
|
this$1.currentIndex = newIndex;
|
|
9155
9208
|
this$1._preIndex = newIndex;
|
|
9156
9209
|
this$1._emitScrollEvent('scrollend');
|
|
9157
|
-
|
|
9210
|
+
}, duration * 1000);
|
|
9158
9211
|
},
|
|
9159
9212
|
|
|
9160
9213
|
_handleTouchCancel: function _handleTouchCancel (event) {
|
package/package.json
CHANGED