previewFileAction: function (e) {
console.log(e.currentTarget.dataset.item.file_name)
wx.showLoading({
title: '正在加载预览',
})
this.setData({
showFileDialog: false
})
var that = this
let file = decodeURIComponent(that.data.obj.file_path);
console.log(file)
file = this.getFilePathName(file);
console.log(file)
wx.downloadFile({
url: that.data.obj.file_path,
header: {
'content-type': 'application/json',
},
filePath: wx.env.USER_DATA_PATH + '/' + that.data.obj.file_name,
success: function (res) {
console.log(res)
const filePath = res.filePath
wx.openDocument({
filePath:filePath,
showMenu: true,
success: function (res) {
wx.hideLoading()
console.log(res)
},
fail: function(res) {
console.log(res)
}
})
},
fail:function(res){
console.log(res)
}
})
},
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。