feat(project): support dynamic title

This commit is contained in:
vben
2024-05-22 22:03:41 +08:00
parent e83adf0697
commit d1cdea430e
15 changed files with 44 additions and 4 deletions

View File

@@ -42,6 +42,9 @@
}
}
},
"peerDependencies": {
"@vben-core/design": "workspace:*"
},
"dependencies": {
"@vben-core/design": "workspace:*",
"@vben-core/iconify": "workspace:*",

View File

@@ -5,12 +5,14 @@ import { $t } from '@vben/locales';
import { staticPreference } from '@vben/preference';
import SelectItem from '../select-item.vue';
import SwitchItem from '../switch-item.vue';
defineOptions({
name: 'PreferenceGeneralConfig',
});
const locale = defineModel<string>('locale');
const dynamicTitle = defineModel<boolean>('dynamicTitle');
const localeItems: SelectListItem[] = staticPreference.supportLanguages.map(
(item) => ({
@@ -24,4 +26,7 @@ const localeItems: SelectListItem[] = staticPreference.supportLanguages.map(
<SelectItem v-model="locale" :items="localeItems">
{{ $t('preference.language') }}
</SelectItem>
<SwitchItem v-model="dynamicTitle">
{{ $t('preference.dynamic-title') }}
</SwitchItem>
</template>

View File

@@ -46,6 +46,7 @@ function updateLocale(value: string) {
:footer-fixed="preference.footerFixed"
:header-mode="preference.headerMode"
:theme="preference.theme"
:dynamic-title="preference.dynamicTitle"
:breadcrumb-hide-only-one="preference.breadcrumbHideOnlyOne"
:page-transition="preference.pageTransition"
:page-progress="preference.pageProgress"
@@ -55,6 +56,7 @@ function updateLocale(value: string) {
:side-collapse-show-title="preference.sideCollapseShowTitle"
:page-transition-enable="preference.pageTransitionEnable"
@update:navigation-style="(value) => handleUpdate('navigationStyle', value)"
@update:dynamic-title="(value) => handleUpdate('dynamicTitle', value)"
@update:tabs-icon="(value) => handleUpdate('tabsIcon', value)"
@update:side-collapse="(value) => handleUpdate('sideCollapse', value)"
@update:locale="updateLocale"

View File

@@ -40,6 +40,7 @@ withDefaults(defineProps<{ colorPrimaryPresets: string[] }>(), {
const theme = defineModel<string>('theme');
const locale = defineModel<string>('locale');
const dynamicTitle = defineModel<boolean>('dynamicTitle');
const semiDarkMenu = defineModel<boolean>('semiDarkMenu');
const breadcrumbVisible = defineModel<boolean>('breadcrumbVisible');
const breadcrumbIcon = defineModel<boolean>('breadcrumbIcon');
@@ -210,7 +211,10 @@ function handleReset() {
</template>
<template #general>
<Block :title="$t('preference.general')">
<General v-model:locale="locale" />
<General
v-model:locale="locale"
v-model:dynamic-title="dynamicTitle"
/>
</Block>
<Block :title="$t('preference.navigation-menu')">
<Navigation