// 文件预览 previewbook:function(e){ console.log(e) var url = e.currentTarget.dataset.url wx.showLoading({ title: '正在打开...', }) wx.downloadFile({ url: url, //仅为测试接口,并非真实的 success: function (res) { console.log(res) var filePath = res.tempFilePath console.log(filePath) wx.openDocument({ filePath: filePath, success: function (res) { console.log("打开文档成功") console.log(res); wx.hideLoading({ success: (res) => { }, }) }, fail: function (res) { console.log("fail"); console.log(res) }, }) } }) },