wx.opendocument微信小程序新開頁(yè)面打開文檔怎么做
wx.openDocument(OBJECT)
新開頁(yè)面打開文檔,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx
OBJECT參數(shù)說(shuō)明:
| 參數(shù) | 說(shuō)明 | 必填 | 說(shuō)明 | 最低版本 |
|---|---|---|---|---|
| filePath | String | 是 | 文件路徑,可通過(guò) downFile 獲得 | |
| fileType | String | 否 | 文件類型,指定文件類型打開文件,有效值 doc, xls, ppt, pdf, docx, xlsx, pptx | 1.4.0 |
| success | Function | 否 | 接口調(diào)用成功的回調(diào)函數(shù) | |
| fail | Function | 否 | 接口調(diào)用失敗的回調(diào)函數(shù) | |
| complete | Function | 否 | 接口調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會(huì)執(zhí)行) |
示例代碼
wx.downloadFile({ url: 'http://example.com/somefile.pdf',
success: function (res) {
var filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log('打開文檔成功')
}
})
}
})
更多微信小程序開發(fā)教程,可以關(guān)注hi小程序。
第二部分:如何開通一個(gè)小商店
- 第 1 頁(yè)【微信小程序API文件】微信小程序API文件,wx.saveFile保存文件到本地
- 第 2 頁(yè)【wx.getfileinfo】 微信小程序獲取文件信息代碼wx.getfileinfo
- 第 3 頁(yè)【wx.getsavedfilelist】 wx.getsavedfilelist獲取本地已保存的小程序文件列表
- 第 4 頁(yè)【wx.removesavedfile】 wx.removesavedfile小程序怎么刪除本地存儲(chǔ)的文件
- 第 5 頁(yè)【wx.opendocument】 wx.opendocument微信小程序新開頁(yè)面打開文檔怎么做

立即掃碼關(guān)注

多門店/直營(yíng)/加盟連鎖管理系統(tǒng)