app端用uni.saveFile保存的文件如何清除
1***@qq.com
- 发布:2020-03-30 16:04
- 更新:2020-03-31 10:24
- 阅读:748
1 个回复
x***@qq.com - 疑问?的小纳?
removefile(){
uni.getSavedFileList({ //获取已经下载的文件
success: function (res) {
console.log(res.fileList); //获取文件数组;
for(var i=0; i<res.fileList.length;i++){ //通过for循环删除每一项
uni.removeSavedFile({ //删除文件
filePath: res.fileList[i].filePath,
success: function (res) {
console.log(res,"删除成功");
uni.showToast({ //删除成功后提示
title:
删除${res.fileList.length}个
,duration: 2000
});
}
});
}
}
});
}
上面方法可以直接复制到methods中使用