wx.downloadFile({
url: this.resume,
success: function(res) {
var filePath = res.tempFilePath,
index1 = filePath.lastIndexOf('.'),
index2 = filePath.length,
suffix = filePath.substring(index1 + 1, index2)
console.log('filePath', filePath)
wx.openDocument({
filePath: filePath,
fileType: suffix,
success: function(res) {
console.log('打开文档成功')
},
fail: (e) => {
console.log(e)
}
})
},
fail: function(res) {
console.log(res)
console.log('文件下载失败')
},
complete: function(res) {}
})
你好,请确认已经配置域名https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html
我也遇到过,在小程序后台配置下载路径就好了
downloadFile 域名配置(确认下载url是https)