// 获取图片对象 export function getImgObj({ canvas, url, callback }) { return new Promise((resolve, reject) => { wx.downloadFile({ url, success: (res) => { if (res.statusCode === 200) { loadImage(canvas, res.tempFilePath).then((imgObj) => { callback(imgObj) resolve() }) } }, fail: (err) => { wx.showToast({ title: '海报资源下载失败', icon: 'none', }) reject(err) }, }) }) } export function loadImage(canvas, imgSrc) { console.log('loadImage -> imgSrc', imgSrc) return new Promise((resolve, reject) => { let _img = canvas.createImage() _img.onload = () => { console.log('背景加载') resolve(_img) } _img.onerror = (err) => { console.log('加载错误', err) wx.showToast({ title: '海报资源加载失败', icon: 'none', }) reject(err) } _img.src = imgSrc }) }
域名已配置 但一直提示fail url not in domain list?域名已配置 但wx.downloadFile接口一直提示fail url not in domain list (只有手机上打开调试功能才可以正常下载,很奇怪),appid wx7c133017736f0055,很急,官方来看下 [图片]
2020-05-07