微信小程序API 文件·刪除本地緩存文件

2022-05-11 16:41 更新

wx.removeSavedFile(Object object)

刪除本地緩存文件

參數(shù)

Object object

屬性 類型 默認(rèn)值 必填 說(shuō)明
filePath string 需要?jiǎng)h除的文件路徑 (本地路徑)
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.getSavedFileList({
 success (res) {
   if (res.fileList.length > 0){
     wx.removeSavedFile({
       filePath: res.fileList[0].filePath,
       complete (res) {
         console.log(res)
       }
     })
   }
 }
})


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)