@dolphinweex/weex-vue-render 0.2.63 → 0.2.64

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.
@@ -5647,6 +5647,15 @@ function getImage(weex) {
5647
5647
  },
5648
5648
  methods: {
5649
5649
  loadImage: function loadImage() {
5650
+ // 检查src是否有效
5651
+ if (!this.src || this.src === 'undefined' || this.src === '') {
5652
+ this.$emit("error", {
5653
+ success: false,
5654
+ message: 'Invalid image source'
5655
+ });
5656
+ return;
5657
+ }
5658
+
5650
5659
  const img = new Image();
5651
5660
  img.src = this.src;
5652
5661
  img.onload = (event) => {
@@ -5663,6 +5672,7 @@ function getImage(weex) {
5663
5672
  // 触发error事件并传递参数
5664
5673
  this.$emit("error", {
5665
5674
  success: false,
5675
+ message: 'Failed to load image: ' + this.src
5666
5676
  });
5667
5677
  };
5668
5678
  },
@@ -5720,9 +5730,9 @@ function getImage(weex) {
5720
5730
  }
5721
5731
  let processedAppendStr = appendStr;
5722
5732
 
5723
- if (/^[a-zA-Z]/i.test(appendStr) && appendStr.includes("/")) {
5724
- return path + appendStr; // 直接返回绝对路径
5725
- }
5733
+ if (/^[a-zA-Z]/i.test(appendStr) && appendStr.includes("/")) {
5734
+ return path + appendStr; // 直接返回绝对路径
5735
+ }
5726
5736
  if (processedAppendStr.startsWith("/")) {
5727
5737
  return path + appendStr;
5728
5738
  }
@@ -5756,9 +5766,18 @@ function getImage(weex) {
5756
5766
  return path + processedAppendStr;
5757
5767
  },
5758
5768
  checkTrim(url) {
5759
- if (url.includes(' ')) {
5760
- const parts = url.replace(/\s/g, match => encodeURIComponent(match));
5761
- return parts
5769
+ try{
5770
+ // 检查URL是否有效
5771
+ if (!url || url === 'undefined') {
5772
+ return '';
5773
+ }
5774
+ if (url.includes(' ')) {
5775
+ const parts = url.replace(/\s/g, match => encodeURIComponent(match));
5776
+ return parts
5777
+ }
5778
+ }catch(e){
5779
+ // 静默处理错误,返回空字符串
5780
+ return '';
5762
5781
  }
5763
5782
  return url
5764
5783
  },
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.63"
52
+ "version": "0.2.64"
53
53
  }