Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 59097e24
authored
Oct 14, 2025
by
zouawen
Committed by
GitHub
Oct 14, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
chore: 新增是否开启首选项导航栏(外观、布局、快捷键、通用)吸顶效果,调整部分样式 (#6804)
1 parent
2ce161e5
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
11 deletions
packages/@core/preferences/src/config.ts
packages/@core/preferences/src/types.ts
packages/@core/ui-kit/shadcn-ui/src/components/segmented/segmented.vue
packages/@core/ui-kit/shadcn-ui/src/components/segmented/tabs-indicator.vue
packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue
packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue
packages/locales/src/langs/en-US/preferences.json
packages/locales/src/langs/zh-CN/preferences.json
packages/@core/preferences/src/config.ts
View file @
59097e2
...
@@ -22,6 +22,7 @@ const defaultPreferences: Preferences = {
...
@@ -22,6 +22,7 @@ const defaultPreferences: Preferences = {
enableCheckUpdates
:
true
,
enableCheckUpdates
:
true
,
enablePreferences
:
true
,
enablePreferences
:
true
,
enableRefreshToken
:
false
,
enableRefreshToken
:
false
,
enableStickyPreferencesNavigationBar
:
true
,
isMobile
:
false
,
isMobile
:
false
,
layout
:
'sidebar-nav'
,
layout
:
'sidebar-nav'
,
locale
:
'zh-CN'
,
locale
:
'zh-CN'
,
...
...
packages/@core/preferences/src/types.ts
View file @
59097e2
...
@@ -59,6 +59,10 @@ interface AppPreferences {
...
@@ -59,6 +59,10 @@ interface AppPreferences {
* @zh_CN 是否开启refreshToken
* @zh_CN 是否开启refreshToken
*/
*/
enableRefreshToken
:
boolean
;
enableRefreshToken
:
boolean
;
/**
* @zh_CN 是否开启首选项导航栏吸顶效果
*/
enableStickyPreferencesNavigationBar
:
boolean
;
/** 是否移动端 */
/** 是否移动端 */
isMobile
:
boolean
;
isMobile
:
boolean
;
/** 布局方式 */
/** 布局方式 */
...
...
packages/@core/ui-kit/shadcn-ui/src/components/segmented/segmented.vue
View file @
59097e2
...
@@ -35,16 +35,24 @@ const tabsIndicatorStyle = computed(() => {
...
@@ -35,16 +35,24 @@ const tabsIndicatorStyle = computed(() => {
width
:
`
${(
100
/
props
.
tabs
.
length
).
toFixed
(
0
)}
%`
,
width
:
`
${(
100
/
props
.
tabs
.
length
).
toFixed
(
0
)}
%`
,
};
};
});
});
function
activeClass
(
tab
:
string
):
string
[]
{
return
tab
===
activeTab
.
value
?
[
'!font-bold'
,
'text-primary'
]
:
[];
}
</
script
>
</
script
>
<
template
>
<
template
>
<Tabs
v-model=
"activeTab"
:default-value=
"getDefaultValue"
>
<Tabs
v-model=
"activeTab"
:default-value=
"getDefaultValue"
>
<TabsList
:style=
"tabsStyle"
class=
"bg-accent relative grid w-full"
>
<TabsList
:style=
"tabsStyle"
class=
"bg-accent !outline-heavy relative grid w-full !outline !outline-2"
>
<TabsIndicator
:style=
"tabsIndicatorStyle"
/>
<TabsIndicator
:style=
"tabsIndicatorStyle"
/>
<template
v-for=
"tab in tabs"
:key=
"tab.value"
>
<template
v-for=
"tab in tabs"
:key=
"tab.value"
>
<TabsTrigger
<TabsTrigger
:value=
"tab.value"
:value=
"tab.value"
class=
"z-20 inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium disabled:pointer-events-none disabled:opacity-50"
:class=
"activeClass(tab.value)"
class=
"hover:text-primary z-20 inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium disabled:pointer-events-none disabled:opacity-50"
>
>
{{
tab
.
label
}}
{{
tab
.
label
}}
</TabsTrigger>
</TabsTrigger>
...
...
packages/@core/ui-kit/shadcn-ui/src/components/segmented/tabs-indicator.vue
View file @
59097e2
...
@@ -23,7 +23,7 @@ const forwardedProps = useForwardProps(delegatedProps);
...
@@ -23,7 +23,7 @@ const forwardedProps = useForwardProps(delegatedProps);
v-bind=
"forwardedProps"
v-bind=
"forwardedProps"
:class=
"
:class=
"
cn(
cn(
'absolute bottom-0 left-0 z-10 h-full w-1/2 translate-x-[--radix-tabs-indicator-position] rounded-full px-0 py-1 pr-
1
transition-[width,transform] duration-300',
'absolute bottom-0 left-0 z-10 h-full w-1/2 translate-x-[--radix-tabs-indicator-position] rounded-full px-0 py-1 pr-
0.5
transition-[width,transform] duration-300',
props.class,
props.class,
)
)
"
"
...
...
packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue
View file @
59097e2
...
@@ -134,14 +134,14 @@ watch(
...
@@ -134,14 +134,14 @@ watch(
<template
v-if=
"theme.type !== 'custom'"
>
<template
v-if=
"theme.type !== 'custom'"
>
<div
<div
:style=
"
{ backgroundColor: theme.color }"
:style=
"
{ backgroundColor: theme.color }"
class="mx-
10
my-2 size-5 rounded-md"
class="mx-
9
my-2 size-5 rounded-md"
>
</div>
>
</div>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<div
class=
"size-full px-
10
py-2"
@
click
.
stop=
"selectColor"
>
<div
class=
"size-full px-
9
py-2"
@
click
.
stop=
"selectColor"
>
<div
class=
"flex-center relative size-5 rounded-sm"
>
<div
class=
"flex-center relative size-5 rounded-sm"
>
<UserRoundPen
<UserRoundPen
class=
"
absolute z-10
size-5 opacity-60 group-hover:opacity-100"
class=
"
z-1 absolute
size-5 opacity-60 group-hover:opacity-100"
/>
/>
<input
<input
ref=
"colorInput"
ref=
"colorInput"
...
...
packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue
View file @
59097e2
...
@@ -16,7 +16,7 @@ import type { SegmentedItem } from '@vben-core/shadcn-ui';
...
@@ -16,7 +16,7 @@ import type { SegmentedItem } from '@vben-core/shadcn-ui';
import
{
computed
,
ref
}
from
'vue'
;
import
{
computed
,
ref
}
from
'vue'
;
import
{
Copy
,
RotateCw
}
from
'@vben/icons'
;
import
{
Copy
,
Pin
,
PinOff
,
RotateCw
}
from
'@vben/icons'
;
import
{
$t
,
loadLocaleMessages
}
from
'@vben/locales'
;
import
{
$t
,
loadLocaleMessages
}
from
'@vben/locales'
;
import
{
import
{
clearPreferencesCache
,
clearPreferencesCache
,
...
@@ -69,6 +69,9 @@ const appContentCompact = defineModel<ContentCompactType>('appContentCompact');
...
@@ -69,6 +69,9 @@ const appContentCompact = defineModel<ContentCompactType>('appContentCompact');
const
appWatermark
=
defineModel
<
boolean
>
(
'appWatermark'
);
const
appWatermark
=
defineModel
<
boolean
>
(
'appWatermark'
);
const
appWatermarkContent
=
defineModel
<
string
>
(
'appWatermarkContent'
);
const
appWatermarkContent
=
defineModel
<
string
>
(
'appWatermarkContent'
);
const
appEnableCheckUpdates
=
defineModel
<
boolean
>
(
'appEnableCheckUpdates'
);
const
appEnableCheckUpdates
=
defineModel
<
boolean
>
(
'appEnableCheckUpdates'
);
const
appEnableStickyPreferencesNavigationBar
=
defineModel
<
boolean
>
(
'appEnableStickyPreferencesNavigationBar'
,
);
const
appPreferencesButtonPosition
=
defineModel
<
PreferencesButtonPositionType
>
(
const
appPreferencesButtonPosition
=
defineModel
<
PreferencesButtonPositionType
>
(
'appPreferencesButtonPosition'
,
'appPreferencesButtonPosition'
,
);
);
...
@@ -241,7 +244,7 @@ async function handleReset() {
...
@@ -241,7 +244,7 @@ async function handleReset() {
<Drawer
<Drawer
:description=
"$t('preferences.subtitle')"
:description=
"$t('preferences.subtitle')"
:title=
"$t('preferences.title')"
:title=
"$t('preferences.title')"
class=
"sm:max-w-sm"
class=
"
!border-0
sm:max-w-sm"
>
>
<template
#
extra
>
<template
#
extra
>
<div
class=
"flex items-center"
>
<div
class=
"flex items-center"
>
...
@@ -249,18 +252,44 @@ async function handleReset() {
...
@@ -249,18 +252,44 @@ async function handleReset() {
:disabled=
"!diffPreference"
:disabled=
"!diffPreference"
:tooltip=
"$t('preferences.resetTip')"
:tooltip=
"$t('preferences.resetTip')"
class=
"relative"
class=
"relative"
@
click=
"handleReset"
>
>
<span
<span
v-if=
"diffPreference"
v-if=
"diffPreference"
class=
"bg-primary absolute right-0.5 top-0.5 h-2 w-2 rounded"
class=
"bg-primary absolute right-0.5 top-0.5 h-2 w-2 rounded"
></span>
></span>
<RotateCw
class=
"size-4"
@
click=
"handleReset"
/>
<RotateCw
class=
"size-4"
/>
</VbenIconButton>
<VbenIconButton
:tooltip=
"
appEnableStickyPreferencesNavigationBar
? $t('preferences.disableStickyPreferencesNavigationBar')
: $t('preferences.enableStickyPreferencesNavigationBar')
"
class=
"relative"
@
click=
"
() =>
(appEnableStickyPreferencesNavigationBar =
!appEnableStickyPreferencesNavigationBar)
"
>
<PinOff
v-if=
"appEnableStickyPreferencesNavigationBar"
class=
"size-4"
/>
<Pin
v-else
class=
"size-4"
/>
</VbenIconButton>
</VbenIconButton>
</div>
</div>
</
template
>
</
template
>
<div
class=
"p-1"
>
<div>
<VbenSegmented
v-model=
"activeTab"
:tabs=
"tabs"
>
<VbenSegmented
v-model=
"activeTab"
:tabs=
"tabs"
:class=
"{
'sticky-tabs-header': appEnableStickyPreferencesNavigationBar,
}"
>
<
template
#
general
>
<
template
#
general
>
<Block
:title=
"$t('preferences.general')"
>
<Block
:title=
"$t('preferences.general')"
>
<General
<General
...
@@ -449,3 +478,11 @@ async function handleReset() {
...
@@ -449,3 +478,11 @@ async function handleReset() {
</Drawer>
</Drawer>
</div>
</div>
</template>
</template>
<
style
scoped
>
:deep
(
.sticky-tabs-header
[
role
=
'tablist'
])
{
position
:
sticky
;
top
:
-12px
;
z-index
:
10
;
}
</
style
>
packages/locales/src/langs/en-US/preferences.json
View file @
59097e2
{
{
"title"
:
"Preferences"
,
"title"
:
"Preferences"
,
"subtitle"
:
"Customize Preferences & Preview in Real Time"
,
"subtitle"
:
"Customize Preferences & Preview in Real Time"
,
"enableStickyPreferencesNavigationBar"
:
"Enable sticky preferences navigation bar"
,
"disableStickyPreferencesNavigationBar"
:
"Disable sticky preferences navigation bar"
,
"resetTip"
:
"Data has changed, click to reset"
,
"resetTip"
:
"Data has changed, click to reset"
,
"resetTitle"
:
"Reset Preferences"
,
"resetTitle"
:
"Reset Preferences"
,
"resetSuccess"
:
"Preferences reset successfully"
,
"resetSuccess"
:
"Preferences reset successfully"
,
...
...
packages/locales/src/langs/zh-CN/preferences.json
View file @
59097e2
{
{
"title"
:
"偏好设置"
,
"title"
:
"偏好设置"
,
"subtitle"
:
"自定义偏好设置 & 实时预览"
,
"subtitle"
:
"自定义偏好设置 & 实时预览"
,
"enableStickyPreferencesNavigationBar"
:
"开启首选项导航栏吸顶效果"
,
"disableStickyPreferencesNavigationBar"
:
"关闭首选项导航栏吸顶效果"
,
"resetTitle"
:
"重置偏好设置"
,
"resetTitle"
:
"重置偏好设置"
,
"resetTip"
:
"数据有变化,点击可进行重置"
,
"resetTip"
:
"数据有变化,点击可进行重置"
,
"resetSuccess"
:
"重置偏好设置成功"
,
"resetSuccess"
:
"重置偏好设置成功"
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment