chore: 提示项目有破坏性更新

This commit is contained in:
pany 2023-07-06 14:10:14 +08:00
parent 025a69883f
commit f9677d9a4a
3 changed files with 26 additions and 8 deletions

View File

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { h } from "vue" import { h } from "vue"
import { useTheme } from "@/hooks/useTheme" import { useTheme } from "@/hooks/useTheme"
import { resetConfigLayout } from "@/utils"
import { ElNotification } from "element-plus" import { ElNotification } from "element-plus"
// Element Plus // Element Plus
import zhCn from "element-plus/lib/locale/lang/zh-cn" import zhCn from "element-plus/lib/locale/lang/zh-cn"
@ -13,6 +14,7 @@ initTheme()
/** 作者小心思 */ /** 作者小心思 */
ElNotification({ ElNotification({
title: "Hello", title: "Hello",
type: "success",
message: h( message: h(
"a", "a",
{ style: "color: teal", target: "_blank", href: "https://github.com/un-pany/v3-admin-vite" }, { style: "color: teal", target: "_blank", href: "https://github.com/un-pany/v3-admin-vite" },
@ -21,6 +23,21 @@ ElNotification({
duration: 0, duration: 0,
position: "bottom-right" position: "bottom-right"
}) })
ElNotification({
title: "提示",
type: "warning",
message: h(
"span",
{
style: "color: teal; cursor: pointer;",
onClick: resetConfigLayout
},
"由于平台 4.1.0 版本新增了多种布局模式,如果出现白屏情况,点击这里或手动前往控制台清理 LocalStorage 缓存数据后刷新页面即可!"
),
duration: 0,
position: "bottom-right",
offset: 150
})
</script> </script>
<template> <template>

View File

@ -2,7 +2,7 @@
import { watchEffect } from "vue" import { watchEffect } from "vue"
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 { resetConfigLayout } from "@/utils"
import { Refresh } from "@element-plus/icons-vue" import { Refresh } from "@element-plus/icons-vue"
const settingsStore = useSettingsStore() const settingsStore = useSettingsStore()
@ -38,12 +38,6 @@ const switchSettings = {
watchEffect(() => { watchEffect(() => {
layoutMode.value !== "left" && (fixedHeader.value = true) layoutMode.value !== "left" && (fixedHeader.value = true)
}) })
/** 重置配置 */
const reset = () => {
removeConfigLayout()
location.reload()
}
</script> </script>
<template> <template>
@ -59,7 +53,7 @@ const reset = () => {
<span class="setting-name">{{ settingName }}</span> <span class="setting-name">{{ settingName }}</span>
<el-switch v-model="settingValue.value" :disabled="layoutMode !== 'left' && settingName === '固定 Header'" /> <el-switch v-model="settingValue.value" :disabled="layoutMode !== 'left' && settingName === '固定 Header'" />
</div> </div>
<el-button type="danger" :icon="Refresh" @click="reset"> </el-button> <el-button type="danger" :icon="Refresh" @click="resetConfigLayout"> </el-button>
</div> </div>
</template> </template>

View File

@ -1,4 +1,5 @@
import dayjs from "dayjs" import dayjs from "dayjs"
import { removeConfigLayout } from "@/utils/cache/local-storage"
/** 格式化时间 */ /** 格式化时间 */
export const formatDateTime = (time: string | number | Date) => { export const formatDateTime = (time: string | number | Date) => {
@ -25,3 +26,9 @@ export const setCssVariableValue = (cssVariableName: string, cssVariableValue: s
console.error(error) console.error(error)
} }
} }
/** 重置项目配置 */
export const resetConfigLayout = () => {
removeConfigLayout()
location.reload()
}