Skip to content

Commit e368302

Browse files
author
Taois
committed
feat:搜索页面缓存清理
1 parent 1b6f3f0 commit e368302

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dashboard/src/components/Header.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
<a-button class="cancel-btn" @click="hideCloseConfirm">
104104
取消
105105
</a-button>
106+
<a-button type="primary" status="warning" class="clear-cache-btn" @click="clearSessionStorage">
107+
仅清缓存
108+
</a-button>
106109
<a-button type="primary" status="danger" class="confirm-btn" @click="confirmClose">
107110
确认关闭
108111
</a-button>
@@ -346,6 +349,17 @@ export default defineComponent({
346349
hideCloseConfirm() {
347350
this.showConfirmModal = false;
348351
},
352+
clearSessionStorage() {
353+
try {
354+
// 清除当前页面的sessionStorage
355+
sessionStorage.clear();
356+
this.showConfirmModal = false;
357+
Message.success("缓存已清除");
358+
} catch (error) {
359+
console.error('清除缓存失败:', error);
360+
Message.error("清除缓存失败");
361+
}
362+
},
349363
confirmClose() {
350364
this.showConfirmModal = false;
351365
Message.info("正在关闭应用...");
@@ -700,6 +714,13 @@ export default defineComponent({
700714
font-weight: 500;
701715
}
702716
717+
.clear-cache-btn {
718+
min-width: 90px;
719+
height: 36px;
720+
border-radius: 6px;
721+
font-weight: 500;
722+
}
723+
703724
.confirm-btn {
704725
min-width: 100px;
705726
height: 36px;

0 commit comments

Comments
 (0)