H5内嵌小程序使用chooseImage选择图片成功后页面直接跳转到首页?
荣耀magic 2手机
async chooseImage(){
let ShopID = await getMallShopId();
await GetConfigOfWXSDK({
'filter': JSON.stringify({
ShopID: ShopID,
Url: encodeURIComponent(location.href.split('#')[0])
})
}).then(res => {
wx.config({
debug: false,
appId: res.appId,
timestamp: res.timestamp,
nonceStr: res.nonceStr,
signature: res.signature,
jsApiList: [
'chooseImage'
]
});
wx.ready(() => {
wx.chooseImage({
count: 1,
sizeType: ['original'],
sourceType: ['album', 'camera'],
success(res) {
// tempFilePath可以作为img标签的src属性显示图片
alert('成功')
console.log(res)
},
fail(err) {
alert('失败')
console.log(err)
},
})
})
})
},