把你的下载地址前缀添加到合法域名就解决了


在调试工具里成功了是因为勾选了下面这项

下面是我的下载并打开函数
javascript
methods: {
// 下载
downloadFileFn(data) {
if (this.detailsObj.currentUserBuy) {
uni.downloadFile({
// data是路径
url: 'https://' + data,
success(res) {
//保存到本地
uni.saveFile({
tempFilePath: res.tempFilePath, //文件的临时路径
success: function(res1) {
const savedFilePath = res1.savedFilePath;
// 打开文件
uni.openDocument({
filePath: savedFilePath,
success: function(res) {
uni.hideLoading()
},
fail: function(res) {
console.log(res)
},
complete: function(res) {
setTimeout(uni.hideLoading(), 4000)
},
});
},
fail: function(err) {
console.log(err)
}
});
},
fail(res) {
console.log(res)
}
})
}
}
}