在小程序webview内嵌的h5页面中调用wx.chooseImage拍照触发刷新页面,app.js以及当前页面的onshow里并没有逻辑代码,只有拍照有这个问题,相册没有。是什么原因啊
uploadImage() {
let that = this;
if (window.__wxjs_environment === "miniprogram") {
wx.miniProgram.getEnv(function (res) {
if (res.miniprogram) {
wx.chooseImage({
count: that.count,
success: function (req) {
that.totalUpload = false
that.syncUpload(req.localIds)
},
fail() {
Toast.fail("选择图片失败!");
},
});
}
});
}
},
syncUpload(localIds) {
const localId = localIds.pop();
const that = this
wx.uploadImage({
localId: localId,
isShowProgressTips: 0,
success: function (resp) {
that.handleUpload2(resp.serverId)
if(localIds.length > 0){
that.syncUpload(localIds);
return
}else{
that.totalUpload = true
}
}
});
},
handleUpload(data){
Toast.loading({
message: '正在上传...',
forbidClick: true,
loadingType: 'spinner',
duration: 0
})
uploadWxFile({codeName:data}).then(response=>{
this.fileList.push({
id: response.fileMidId,
url: response.fileUrl,
})
this.$emit("change", this.fileList)
if(this.totalUpload){
Toast.clear()
}
}).catch(()=>{
if(this.totalUpload){
Toast.clear()
}
this.$toast.fail('上传失败!')
})
},
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
同遇到这个问题,试过 把sizeType设置为compressed,count设置为1 都没有用。
遇到一样的问题