@@ -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=>{
},