小程序
小游戏
企业微信
微信支付
扫描小程序码分享
wx.cloud.downloadFile下载云存储图片后,在addPhoneContact中photoFilePath如何引用
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
xxxx: async function(){
let res = await wx.cloud.downloadFile({....})
wx.saveFile({
tempFilePath: res.tempFilePath,
success(e) {
wx.addPhoneContact({
photoFilePath:e.savedFilePath
...
})
}
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
xxxx: async function(){
let res = await wx.cloud.downloadFile({....})
wx.saveFile({
tempFilePath: res.tempFilePath,
success(e) {
wx.addPhoneContact({
photoFilePath:e.savedFilePath
...
})
}
})
}
报错全文:saveFile:fail parameter error: parameter.tempFilePath should be String instead of Undefined;
代码全文
addPhone: async function () {
let res = await wx.cloud.downloadFile({
fileID: 'cloud://hansh-aeg0m.6861-hansh-aeg0m-1300681430/logo.png',
success: res => {
// get temp file path
console.log(res.tempFilePath)
},
fail: err => {
// handle error
}
});
wx.saveFile({
tempFilePath: res.tempFilePath,
success(e) {
wx.addPhoneContact({
photoFilePath: e.savedFilePath,
firstName: this.data.date_List[0]['name'],//联系人姓名
mobilePhoneNumber: this.data.date_List[0]['phone'],//联系人手机号
organization: this.data.date_List[0]['company'],
workAddressStreet: this.data.date_List[0]['address'],
title: this.data.date_List[0]['post'],
success: function () {
console.log('添加成功')
}
})
}
})
}