|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ElDrawer, ElDivider } from 'element-plus'
|
|
|
+import { ElDrawer, ElDivider, ElButton, ElMessage } from 'element-plus'
|
|
|
import { ref, unref, computed, watch } from 'vue'
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
import { ThemeSwitch } from '@/components/ThemeSwitch'
|
|
@@ -10,6 +10,8 @@ import { trim, setCssVar } from '@/utils'
|
|
|
import ColorRadioPicker from './components/ColorRadioPicker.vue'
|
|
|
import InterfaceDisplay from './components/InterfaceDisplay.vue'
|
|
|
import LayoutRadioPicker from './components/LayoutRadioPicker.vue'
|
|
|
+import { useCache } from '@/hooks/web/useCache'
|
|
|
+import { useClipboard } from '@vueuse/core'
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
|
@@ -100,6 +102,84 @@ watch(
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
+
|
|
|
+// 拷贝
|
|
|
+const copyConfig = async () => {
|
|
|
+ const { copy, copied } = useClipboard({
|
|
|
+ source: `
|
|
|
+// 面包屑
|
|
|
+breadcrumb: ${appStore.getBreadcrumb},
|
|
|
+// 面包屑图标
|
|
|
+breadcrumbIcon: ${appStore.getBreadcrumbIcon},
|
|
|
+// 折叠图标
|
|
|
+hamburger: ${appStore.getHamburger},
|
|
|
+// 全屏图标
|
|
|
+screenfull: ${appStore.getScreenfull},
|
|
|
+// 尺寸图标
|
|
|
+size: ${appStore.getSize},
|
|
|
+// 多语言图标
|
|
|
+locale: ${appStore.getLocale},
|
|
|
+// 标签页
|
|
|
+tagsView: ${appStore.getTagsView},
|
|
|
+// logo
|
|
|
+logo: ${appStore.getLogo},
|
|
|
+// 固定header
|
|
|
+fixedHeader: ${appStore.getFixedHeader},
|
|
|
+// 灰色模式
|
|
|
+greyMode: ${appStore.getGreyMode},
|
|
|
+// layout布局
|
|
|
+layout: '${appStore.getLayout}',
|
|
|
+// 暗黑模式
|
|
|
+isDark: ${appStore.getIsDark},
|
|
|
+// 组件尺寸
|
|
|
+currentSize: '${appStore.getCurrentSize}',
|
|
|
+// 主题相关
|
|
|
+theme: {
|
|
|
+ // 主题色
|
|
|
+ elColorPrimary: '${appStore.getTheme.elColorPrimary}',
|
|
|
+ // 左侧菜单边框颜色
|
|
|
+ leftMenuBorderColor: '${appStore.getTheme.leftMenuBorderColor}',
|
|
|
+ // 左侧菜单背景颜色
|
|
|
+ leftMenuBgColor: '${appStore.getTheme.leftMenuBgColor}',
|
|
|
+ // 左侧菜单浅色背景颜色
|
|
|
+ leftMenuBgLightColor: '${appStore.getTheme.leftMenuBgLightColor}',
|
|
|
+ // 左侧菜单选中背景颜色
|
|
|
+ leftMenuBgActiveColor: '${appStore.getTheme.leftMenuBgActiveColor}',
|
|
|
+ // 左侧菜单收起选中背景颜色
|
|
|
+ leftMenuCollapseBgActiveColor: '${appStore.getTheme.leftMenuCollapseBgActiveColor}',
|
|
|
+ // 左侧菜单字体颜色
|
|
|
+ leftMenuTextColor: '${appStore.getTheme.leftMenuTextColor}',
|
|
|
+ // 左侧菜单选中字体颜色
|
|
|
+ leftMenuTextActiveColor: '${appStore.getTheme.leftMenuTextActiveColor}',
|
|
|
+ // logo字体颜色
|
|
|
+ logoTitleTextColor: '${appStore.getTheme.logoTitleTextColor}',
|
|
|
+ // logo边框颜色
|
|
|
+ logoBorderColor: '${appStore.getTheme.logoBorderColor}',
|
|
|
+ // 头部背景颜色
|
|
|
+ topHeaderBgColor: '${appStore.getTheme.topHeaderBgColor}',
|
|
|
+ // 头部字体颜色
|
|
|
+ topHeaderTextColor: '${appStore.getTheme.topHeaderTextColor}',
|
|
|
+ // 头部悬停颜色
|
|
|
+ topHeaderHoverColor: '${appStore.getTheme.topHeaderHoverColor}',
|
|
|
+ // 头部边框颜色
|
|
|
+ topToolBorderColor: '${appStore.getTheme.topToolBorderColor}'
|
|
|
+}
|
|
|
+ `
|
|
|
+ })
|
|
|
+ await copy()
|
|
|
+ if (unref(copied)) {
|
|
|
+ ElMessage.success(t('setting.copySuccess'))
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 清空缓存
|
|
|
+const clear = () => {
|
|
|
+ const { wsCache } = useCache()
|
|
|
+ wsCache.delete('layout')
|
|
|
+ wsCache.delete('theme')
|
|
|
+ wsCache.delete('isDark')
|
|
|
+ window.location.reload()
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -181,6 +261,16 @@ watch(
|
|
|
<!-- 界面显示 -->
|
|
|
<ElDivider>{{ t('setting.interfaceDisplay') }}</ElDivider>
|
|
|
<InterfaceDisplay />
|
|
|
+
|
|
|
+ <ElDivider />
|
|
|
+ <div>
|
|
|
+ <ElButton type="primary" class="w-full" @click="copyConfig">{{ t('setting.copy') }}</ElButton>
|
|
|
+ </div>
|
|
|
+ <div class="mt-5px">
|
|
|
+ <ElButton type="danger" class="w-full" @click="clear">
|
|
|
+ {{ t('setting.clearAndReset') }}
|
|
|
+ </ElButton>
|
|
|
+ </div>
|
|
|
</ElDrawer>
|
|
|
</template>
|
|
|
|