@dolphinweex/weex-vue-render 0.2.89 → 0.2.90

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.
@@ -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
- const isFlvFile = this.src && this.src.toLowerCase().endsWith('.flv');
5886
- return createElement(isFlvFile ? "video" : "figure", {
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(this.src)})`,
5911
+ backgroundImage: displaySrc ? `url(${this.checkTrim(displaySrc)})` : '',
5900
5912
  backgroundSize: this.resize || "stretch",
5901
5913
  backgroundRepeat: "no-repeat",
5902
5914
  },
@@ -8461,6 +8473,14 @@ var slideMixin = {
8461
8473
  // clone._inShow = origNode._inShow
8462
8474
  clone.index = origNode.index;
8463
8475
  clone.style.zIndex = 0;
8476
+ // clone 中的 embed 需要保留以维持布局,但必须修改 id 防止触发同层渲染 CREATE 生命周期
8477
+ // (CREATE 会替换原始 embed 的 controller,导致原视频失去 rootNode)
8478
+ // 约定:id 以 "clone_" 开头的 embed 在 SameLayerManager 里会被直接忽略
8479
+ // var cloneEmbeds = clone.querySelectorAll('embed');
8480
+ // for (var ci = 0; ci < cloneEmbeds.length; ci++) {
8481
+ // var origId = cloneEmbeds[ci].getAttribute('id') || '';
8482
+ // cloneEmbeds[ci].setAttribute('id', 'weexVueRender_clone_' + origId);
8483
+ // }
8464
8484
  this.$refs.inner.appendChild(clone);
8465
8485
  arr.push(clone);
8466
8486
  return clone
@@ -8501,6 +8521,14 @@ var slideMixin = {
8501
8521
  cloneNode._isClone = true;
8502
8522
  cloneNode._originalNode = originalNode;
8503
8523
 
8524
+ // clone 中的 embed 需要保留以维持布局,但必须修改 id 防止触发同层渲染 CREATE 生命周期
8525
+ // 约定:id 以 "clone_" 开头的 embed 在 SameLayerManager 里会被直接忽略
8526
+ // var cloneEmbeds = cloneNode.querySelectorAll('embed');
8527
+ // for (var ci = 0; ci < cloneEmbeds.length; ci++) {
8528
+ // var origId = cloneEmbeds[ci].getAttribute('id') || '';
8529
+ // cloneEmbeds[ci].setAttribute('id', 'weexVueRender_clone_' + origId);
8530
+ // }
8531
+
8504
8532
  // 预设所有图片元素的背景图片,避免重新加载
8505
8533
  var originalImages = originalNode.querySelectorAll('[style*="background-image"]');
8506
8534
  var clonedImages = cloneNode.querySelectorAll('[style*="background-image"], [data-img-src]');
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.89"
52
+ "version": "0.2.90"
53
53
  }