feat: 新增重置布局配置项功能
This commit is contained in:
parent
f800a8d202
commit
e2ebc1da85
@ -1,6 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { storeToRefs } from "pinia"
|
import { storeToRefs } from "pinia"
|
||||||
import { useSettingsStore } from "@/store/modules/settings"
|
import { useSettingsStore } from "@/store/modules/settings"
|
||||||
|
import { removeConfigLayout } from "@/utils/cache/local-storage"
|
||||||
|
import { Refresh } from "@element-plus/icons-vue"
|
||||||
|
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore()
|
||||||
|
|
||||||
@ -29,6 +31,12 @@ const switchSettings = {
|
|||||||
显示灰色模式: showGreyMode,
|
显示灰色模式: showGreyMode,
|
||||||
显示色弱模式: showColorWeakness
|
显示色弱模式: showColorWeakness
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 重置配置 */
|
||||||
|
const reset = () => {
|
||||||
|
removeConfigLayout()
|
||||||
|
location.reload()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -38,6 +46,7 @@ const switchSettings = {
|
|||||||
<span class="setting-name">{{ settingName }}</span>
|
<span class="setting-name">{{ settingName }}</span>
|
||||||
<el-switch v-model="settingValue.value" />
|
<el-switch v-model="settingValue.value" />
|
||||||
</div>
|
</div>
|
||||||
|
<el-button type="danger" :icon="Refresh" @click="reset">重 置</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -56,5 +65,9 @@ const switchSettings = {
|
|||||||
@include ellipsis;
|
@include ellipsis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.el-button {
|
||||||
|
margin-top: 40px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
3
src/utils/cache/local-storage.ts
vendored
3
src/utils/cache/local-storage.ts
vendored
@ -14,6 +14,9 @@ export const getConfigLayout = () => {
|
|||||||
export const setConfigLayout = (settings: LayoutSettings) => {
|
export const setConfigLayout = (settings: LayoutSettings) => {
|
||||||
localStorage.setItem(CacheKey.CONFIG_LAYOUT, JSON.stringify(settings))
|
localStorage.setItem(CacheKey.CONFIG_LAYOUT, JSON.stringify(settings))
|
||||||
}
|
}
|
||||||
|
export const removeConfigLayout = () => {
|
||||||
|
localStorage.removeItem(CacheKey.CONFIG_LAYOUT)
|
||||||
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 侧边栏状态
|
//#region 侧边栏状态
|
||||||
|
Loading…
x
Reference in New Issue
Block a user