fix
This commit is contained in:
@@ -42,6 +42,9 @@
|
||||
<van-cell-group inset>
|
||||
<van-cell title="查看日志" is-link @click="handleLogView" />
|
||||
</van-cell-group>
|
||||
<van-cell-group inset>
|
||||
<van-cell title="清除缓存" is-link @click="handleClearCache" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="detail-header" style="padding-bottom: 5px;">
|
||||
<p>账户</p>
|
||||
@@ -263,6 +266,29 @@ const handleLogout = async () => {
|
||||
const handleLogView = () => {
|
||||
router.push({ name: 'log' })
|
||||
}
|
||||
|
||||
const handleClearCache = async () => {
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
title: '提示',
|
||||
message: '确定要清除缓存吗?此操作不可撤销。',
|
||||
})
|
||||
|
||||
// PWA程序强制页面更新到最新版本
|
||||
if ('serviceWorker' in navigator && navigator.serviceWorker.controller) {
|
||||
navigator.serviceWorker.controller.postMessage({ type: 'SKIP_WAITING' });
|
||||
} else {
|
||||
showToast('当前未使用缓存,无需清除')
|
||||
return
|
||||
}
|
||||
|
||||
showSuccessToast('缓存已清除')
|
||||
} catch (error) {
|
||||
console.error('取消清除缓存:', error)
|
||||
showToast('已取消清除缓存')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user