国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

微信小程序API 文件


wx.saveFile(OBJECT)

保存文件到本地。

OBJECT參數(shù)說(shuō)明:

QQ截圖20170208111050.png

示例代碼:

wx.startRecord({
  success: function(res) {
    var tempFilePath = res.tempFilePath
    wx.saveFile({
      tempFilePath: tempFilePath,
      success: function(res) {
        var savedFilePath = res.savedFilePath
      }
    })
  }
})

bug & tip

  1. tip: 本地文件存儲(chǔ)的大小限制為 10M

wx.getSavedFileList(OBJECT)

獲取本地已保存的文件列表

OBJECT參數(shù)說(shuō)明:

QQ截圖20170208111110.png

success返回參數(shù)說(shuō)明:

QQ截圖20170208111218.png

fileList中的項(xiàng)目說(shuō)明:

QQ截圖20170208111223.png

示例代碼:

wx.getSavedFileList({
  success: function(res) {
    console.log(res.fileList)
  }
})


wx.getSavedFileInfo(OBJECT)

獲取本地文件的文件信息

OBJECT參數(shù)說(shuō)明:

QQ截圖20170208111227.png

success返回參數(shù)說(shuō)明:

QQ截圖20170208111239.png

示例代碼:

wx.getSavedFileInfo({
  filePath: 'wxfile://somefile', //僅做示例用,非真正的文件路徑
  success: function(res) {
    console.log(res.size)
    console.log(res.createTime)
  }
})


wx.removeSavedFile(OBJECT)

刪除本地存儲(chǔ)的文件

OBJECT參數(shù)說(shuō)明:

QQ截圖20170208111244.png

示例代碼:

wx.getSavedFileList({
  success: function(res) {
    if (res.fileList.length > 0){
      wx.removeSavedFile({
        filePath: res.fileList[0].filePath,
        complete: function(res) {
          console.log(res)
        }
      })
    }
  }
})


wx.openDocument(OBJECT)

新開(kāi)頁(yè)面打開(kāi)文檔,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx

OBJECT參數(shù)說(shuō)明:

參數(shù)說(shuō)明必填說(shuō)明
filePathString文件路徑,可通過(guò) downFile 獲得
successFunction接口調(diào)用成功的回調(diào)函數(shù)
failFunction接口調(diào)用失敗的回調(diào)函數(shù)
completeFunction接口調(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('打開(kāi)文檔成功')
      }
    })
  }
})