refactor: ♻️ 设置项 class 类名修改、完善方法注释
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<el-divider>{{ $t("settings.interface") }}</el-divider>
|
<el-divider>{{ $t("settings.interface") }}</el-divider>
|
||||||
|
|
||||||
<div class="settings-option">
|
<div class="setting-item">
|
||||||
<span class="text-xs">{{ $t("settings.themeColor") }}</span>
|
<span class="text-xs">{{ $t("settings.themeColor") }}</span>
|
||||||
<ThemeColorPicker
|
<ThemeColorPicker
|
||||||
v-model="settingsStore.themeColor"
|
v-model="settingsStore.themeColor"
|
||||||
@@ -25,22 +25,22 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="settings-option">
|
<div class="setting-item">
|
||||||
<span class="text-xs">{{ $t("settings.tagsView") }}</span>
|
<span class="text-xs">{{ $t("settings.tagsView") }}</span>
|
||||||
<el-switch v-model="settingsStore.tagsView" />
|
<el-switch v-model="settingsStore.tagsView" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="settings-option">
|
<div class="setting-item">
|
||||||
<span class="text-xs">{{ $t("settings.fixedHeader") }}</span>
|
<span class="text-xs">{{ $t("settings.fixedHeader") }}</span>
|
||||||
<el-switch v-model="settingsStore.fixedHeader" />
|
<el-switch v-model="settingsStore.fixedHeader" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="settings-option">
|
<div class="setting-item">
|
||||||
<span class="text-xs">{{ $t("settings.sidebarLogo") }}</span>
|
<span class="text-xs">{{ $t("settings.sidebarLogo") }}</span>
|
||||||
<el-switch v-model="settingsStore.sidebarLogo" />
|
<el-switch v-model="settingsStore.sidebarLogo" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="settings-option">
|
<div class="setting-item">
|
||||||
<span class="text-xs">{{ $t("settings.watermark") }}</span>
|
<span class="text-xs">{{ $t("settings.watermark") }}</span>
|
||||||
<el-switch v-model="settingsStore.watermarkEnabled" />
|
<el-switch v-model="settingsStore.watermarkEnabled" />
|
||||||
</div>
|
</div>
|
||||||
@@ -73,25 +73,19 @@ const settingsVisible = computed({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/** 切换主题颜色 */
|
||||||
* 切换主题颜色
|
|
||||||
*/
|
|
||||||
function changeThemeColor(color: string) {
|
function changeThemeColor(color: string) {
|
||||||
settingsStore.changeThemeColor(color);
|
settingsStore.changeThemeColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** 切换主题 */
|
||||||
* 切换主题
|
|
||||||
*/
|
|
||||||
const isDark = ref<boolean>(settingsStore.theme === ThemeEnum.DARK);
|
const isDark = ref<boolean>(settingsStore.theme === ThemeEnum.DARK);
|
||||||
const changeTheme = (val: any) => {
|
const changeTheme = (val: any) => {
|
||||||
isDark.value = val;
|
isDark.value = val;
|
||||||
settingsStore.changeTheme(isDark.value ? ThemeEnum.DARK : ThemeEnum.LIGHT);
|
settingsStore.changeTheme(isDark.value ? ThemeEnum.DARK : ThemeEnum.LIGHT);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** 切换布局 */
|
||||||
* 切换布局
|
|
||||||
*/
|
|
||||||
function changeLayout(layout: string) {
|
function changeLayout(layout: string) {
|
||||||
settingsStore.changeLayout(layout);
|
settingsStore.changeLayout(layout);
|
||||||
if (layout === LayoutEnum.MIX) {
|
if (layout === LayoutEnum.MIX) {
|
||||||
@@ -99,6 +93,7 @@ function changeLayout(layout: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 重新激活顶部菜单 */
|
||||||
function againActiveTop(newVal: string) {
|
function againActiveTop(newVal: string) {
|
||||||
const parent = findOutermostParent(permissionStore.routes, newVal);
|
const parent = findOutermostParent(permissionStore.routes, newVal);
|
||||||
if (appStore.activeTopMenu !== parent.path) {
|
if (appStore.activeTopMenu !== parent.path) {
|
||||||
@@ -106,6 +101,7 @@ function againActiveTop(newVal: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 递归查找最外层父节点 */
|
||||||
function findOutermostParent(tree: any[], findName: string) {
|
function findOutermostParent(tree: any[], findName: string) {
|
||||||
let parentMap: any = {};
|
let parentMap: any = {};
|
||||||
|
|
||||||
@@ -136,7 +132,7 @@ function findOutermostParent(tree: any[], findName: string) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.settings-option {
|
.setting-item {
|
||||||
@apply py-1 flex-x-between;
|
@apply py-1 flex-x-between;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user