|
導(dǎo)讀微信小程序,簡稱小程序,英文名Mini Program,是一種不需要下載安裝即可使用的應(yīng)用,它實現(xiàn)了應(yīng)用“觸手可及”的夢想,用戶掃一掃或搜一下即可打開應(yīng)用。小程序是一種不用下載就能使用的應(yīng)用,也是一... 微信小程序,簡稱小程序,英文名Mini Program,是一種不需要下載安裝即可使用的應(yīng)用,它實現(xiàn)了應(yīng)用“觸手可及”的夢想,用戶掃一掃或搜一下即可打開應(yīng)用。小程序是一種不用下載就能使用的應(yīng)用,也是一項門檻非常高的創(chuàng)新,經(jīng)過將近兩年的發(fā)展,已經(jīng)構(gòu)造了新的小程序開發(fā)環(huán)境和開發(fā)者生態(tài)。 wx.saveFile(OBJECT)保存文件到本地。 OBJECT參數(shù)說明: [tr]參數(shù)類型必填說明[/tr]
示例代碼: wx.startRecord({
success: function(res) {
var tempFilePath = res.tempFilePath wx.saveFile({
tempFilePath: tempFilePath,
success: function(res) {
var savedFilePath = res.savedFilePath
}
})
}
}) wx.getSavedFileList(OBJECT)
success返回參數(shù)說明:
fileList中的項目說明:
示例代碼: wx.getSavedFileList({
success: function(res) {
console.log(res.fileList)
}
}) wx.getSavedFileInfo(OBJECT)復(fù)制代碼
success返回參數(shù)說明:
示例代碼: wx.getSavedFileInfo({
filePath: 'wxfile://somefile',
//僅做示例用,非真正的文件路徑
success: function(res) {
console.log(res.size) console.log(res.createTime)
}
}) wx.removeSavedFile(OBJECT)
示例代碼: 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)
示例代碼 wx.downloadFile({
url: 'http://example.com/somefile.pdf',
success: function (res) {
var filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log('打開文檔成功')
}
})
}
})更多微信小程序:文件管理 API說明相關(guān)文章請關(guān)注PHP中文網(wǎng)! 小程序是一種不需要下載安裝即可使用的應(yīng)用,它實現(xiàn)了應(yīng)用“觸手可及”的夢想,用戶掃一掃或者搜一下即可打開應(yīng)用。 |
溫馨提示:喜歡本站的話,請收藏一下本站!