wx.openDocument()微信小程序打開word文件不能轉發/編輯 問題

一、wx.openDocument()微信小程序打開word文件不能轉發/編輯 問題解決方案

說明:

新版本需要手動指定showMenu=true

 

wx.openDocument(Object object)

新開頁面打開文檔。微信客戶端 7.0.12 版本前默認顯示右上角菜單按鈕,之後的版本默認不顯示,需主動傳入 showMenu

參數

Object object

屬性 類型 默認值 必填 說明 最低版本
filePath string   文件路徑 (本地路徑) ,可通過 downloadFile 獲得  
showMenu boolean false 是否顯示右上角菜單 2.11.0
fileType string   文件類型,指定文件類型打開文件 1.4.0
success function   接口調用成功的回調函數  
fail function   接口調用失敗的回調函數  
complete function   接口調用結束的回調函數(調用成功、失敗都會執行)

object.fileType 的合法值

說明 最低版本
doc doc 格式  
docx docx 格式  
xls xls 格式  
xlsx xlsx 格式  
ppt ppt 格式  
pptx pptx 格式  
pdf pdf 格式  

示例代碼

 wx.openDocument({
        filePath: res,
        fileType:"docx",
        showMenu:true,
        success: (res) => {
          console.info(res);
          wx.showToast({
            title: '打開成功',
          })
          if (onSuccess)
            onSuccess();
        }
      })

 

 

IOS 顯示效果如下:右上角 能轉發

 

Android系統顯示如下,使用QQ瀏覽器打卡可以轉發+編輯:

 

 

 

更多:

 微信小程序Echarts 圖表組件使用整理

 微信小程序 wx.getSystemInfo 返回的platform的值有哪些?

 微信小程序分享朋友圈功能上線

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章