微信小程序之打开文档功能
/* 打开文档 * @param fileUrl: 文件地址 * @param filetype: 文件类型 */ openDocument(fileUrl, filetype) { wx.downloadFile({ url: fileUrl, success: res => { const filePath = res.tempFilePath; wx.openDocument({ filePath: filePath, fileType: filetype, success: function (res) { // console.log("打开文档成功") }, fail: function (res) { wx.showToast({title: '打开文档失败', icon: 'none', duration: 2000}) }, }) }, fail: res => { console.log(res); }, }); }
- 上一篇 »微信小程序自动化测试环境部署及应用,minium
- 下一篇 »微信小程序 生成小程序码