下载 压缩包 文件,在安卓端下载,采用下面的代码当不是文档的时候,就会弹出下载文件的界面,但是在苹果端就不能出现,请问怎样才能出现下载文件
的界面,能够将下载的文件分享给朋友?
wx.cloud.downloadFile({
fileID: fileId
}).then(res => {
console.log('下载成功', res)
var filePath = res.tempFilePath
var filename = filePath;
var index1 = filename.lastIndexOf(".");
var index2 = filename.length;
var postf = filename.substring(index1, index2);
var postf1 = postf.replace(/\./g, '')
wx.openDocument({
filePath: res.tempFilePath,
fileType: postf1 ,
showMenu: true,
success: function (res) {
console.log('打开文档成功')
},
fail: console.log('打开文档失败'),
})
}).catch(res => {
console.log('下载失败', res)
})
} else {
wx.showToast({
icon: "none",
title: '下载链接为空了',
})
}
}