liyongli 1 년 전
부모
커밋
8f68c342a2
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      pages/downZS/index.js

+ 10 - 0
pages/downZS/index.js

@@ -13,6 +13,10 @@ Page({
    */
   onLoad(options) {
     // 获取远程图片
+    wx.showLoading({
+      title: '加载中',
+      mask: true
+    })
     wx.getImageInfo({
       src: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/6.jpg",
     }).then((res) => {
@@ -48,10 +52,16 @@ Page({
               width,
               height
             });
+          },
+          complete: () => {
+            wx.hideLoading();
           }
         })
       }
+      img.onerror = () => wx.hideLoading();
       img.src = path // 要加载的图片 url
+    }).catch(err=>{
+      wx.hideLoading();
     });
   },