新聞中心
- swan.openDocument
- 方法參數(shù)
- object 參數(shù)說(shuō)明
- 示例
- 圖片示例
- 代碼示例
- 錯(cuò)誤碼
- Android
- iOS
- 方法參數(shù)
swan.openDocument
解釋:新開(kāi)頁(yè)面打開(kāi)文檔,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。
Web 態(tài)說(shuō)明: Web 態(tài)只支持在部分瀏覽器環(huán)境下打開(kāi) pdf 格式文檔,其他情形會(huì)觸發(fā) fail 回調(diào)。

方法參數(shù)
Object object
object 參數(shù)說(shuō)明
| 屬性名 | 類型 | 必填 | 默認(rèn)值 | 說(shuō)明 |
|---|---|---|---|---|
|
filePath |
String |
是 |
文件路徑,可通過(guò) downloadFile 獲得 |
|
|
fileType |
String |
否 |
文件類型,指定文件類型打開(kāi)文件,有效值 doc, xls, ppt, pdf, docx, xlsx, pptx |
|
|
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í)行) |
示例
跳轉(zhuǎn)編輯工具
在開(kāi)發(fā)者工具中打開(kāi)
在 WEB IDE 中打開(kāi)
掃碼體驗(yàn)
代碼示例
請(qǐng)使用百度APP掃碼
圖片示例
代碼示例
- SWAN
- JS
示例文件.pdf
錯(cuò)誤碼
Android
| 錯(cuò)誤碼 | 說(shuō)明 |
|---|---|
|
202 |
解析失敗,請(qǐng)檢查參數(shù)是否正確 |
|
1001 |
執(zhí)行失敗 |
iOS
| 錯(cuò)誤碼 | 說(shuō)明 |
|---|---|
|
202 |
解析失敗,請(qǐng)檢查參數(shù)是否正確 |
|
2001 |
文件不存在 |
|
2005 |
文件格式不支持 |
文章名稱:創(chuàng)新互聯(lián)百度小程序教程:swan.openDocument
URL網(wǎng)址:http://www.5511xx.com/article/cdseecs.html


咨詢
建站咨詢
