uniapp管理APP缓存1234567891011121314151617181920212223242526272829303132// 获取getCacheSize() { // #ifdef APP-PLUS plus.cache.calculate((size) => { const sizeInt = parseInt(size) if (sizeInt < 1024) { this.cacheSize = '0KB' } else if (sizeInt < 1048576) { this.cacheSize = `${(sizeInt / 1024).toFixed(2)}KB` } else { this.cacheSize = `${(sizeInt / 1048576).toFixed(2)}MB` } }) // #endif}clearCache() { // #ifdef APP-PLUS uni.showModal({ title: '确认清除?', content: '清除缓存将清空登录信息,需要重新启动应用进行登录', success: (res) => { if (res.confirm) { plus.cache.clear(() => { this.getCacheSize() plus.runtime.restart() }) } }, }) // #endif}文章作者: pengweifu文章链接: https://www.pengwf.com/2023/01/02/web/JS-Uniapp-ClearCache/版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 麦子的博客!vue 打赏微信支付宝上一篇Javascript 录制麦克风声音下一篇uniapp管理APP更新 相关推荐 2023-01-02uniapp管理APP更新 2022-09-10uniapp踩坑心得 2022-05-15Vite2.x + Vue.js3.x + TS起步 评论