From e2ebc1da8513eeba4eaecf93973bdd8c408a66f4 Mon Sep 17 00:00:00 2001
From: pany <939630029@qq.com>
Date: Fri, 30 Jun 2023 18:03:19 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=87=8D=E7=BD=AE?=
 =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/layout/components/Settings/index.vue | 13 +++++++++++++
 src/utils/cache/local-storage.ts         |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue
index 3b83a88..eafa840 100644
--- a/src/layout/components/Settings/index.vue
+++ b/src/layout/components/Settings/index.vue
@@ -1,6 +1,8 @@
 <script lang="ts" setup>
 import { storeToRefs } from "pinia"
 import { useSettingsStore } from "@/store/modules/settings"
+import { removeConfigLayout } from "@/utils/cache/local-storage"
+import { Refresh } from "@element-plus/icons-vue"
 
 const settingsStore = useSettingsStore()
 
@@ -29,6 +31,12 @@ const switchSettings = {
   显示灰色模式: showGreyMode,
   显示色弱模式: showColorWeakness
 }
+
+/** 重置配置 */
+const reset = () => {
+  removeConfigLayout()
+  location.reload()
+}
 </script>
 
 <template>
@@ -38,6 +46,7 @@ const switchSettings = {
       <span class="setting-name">{{ settingName }}</span>
       <el-switch v-model="settingValue.value" />
     </div>
+    <el-button type="danger" :icon="Refresh" @click="reset">重 置</el-button>
   </div>
 </template>
 
@@ -56,5 +65,9 @@ const switchSettings = {
       @include ellipsis;
     }
   }
+  .el-button {
+    margin-top: 40px;
+    width: 100%;
+  }
 }
 </style>
diff --git a/src/utils/cache/local-storage.ts b/src/utils/cache/local-storage.ts
index 6b10587..2f4cade 100644
--- a/src/utils/cache/local-storage.ts
+++ b/src/utils/cache/local-storage.ts
@@ -14,6 +14,9 @@ export const getConfigLayout = () => {
 export const setConfigLayout = (settings: LayoutSettings) => {
   localStorage.setItem(CacheKey.CONFIG_LAYOUT, JSON.stringify(settings))
 }
+export const removeConfigLayout = () => {
+  localStorage.removeItem(CacheKey.CONFIG_LAYOUT)
+}
 //#endregion
 
 //#region 侧边栏状态