|
导读微信小程序,简称小程序,英文名Mini Program,是一种不需要下载安装即可使用的应用,它实现了应用“触手可及”的梦想,用户扫一扫或搜一下即可打开应用。小程序是一种不用下载就能使用的应用,也是一... 微信小程序,简称小程序,英文名Mini Program,是一种不需要下载安装即可使用的应用,它实现了应用“触手可及”的梦想,用户扫一扫或搜一下即可打开应用。小程序是一种不用下载就能使用的应用,也是一项门槛非常高的创新,经过将近两年的发展,已经构造了新的小程序开发环境和开发者生态。 wx.saveFile(OBJECT)保存文件到本地。 OBJECT参数说明: [tr]参数类型必填说明[/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返回参数说明:
fileList中的项目说明:
示例代码: wx.getSavedFileList({
success: function(res) {
console.log(res.fileList)
}
}) wx.getSavedFileInfo(OBJECT)复制代码
success返回参数说明:
示例代码: 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说明相关文章请关注PHP中文网! 小程序是一种不需要下载安装即可使用的应用,它实现了应用“触手可及”的梦想,用户扫一扫或者搜一下即可打开应用。 |
温馨提示:喜欢本站的话,请收藏一下本站!