Skip to content

Commit

Permalink
docs: add tabbar wheelable tips
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetfan committed Dec 13, 2024
1 parent 5605e55 commit 80c8528
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/@core/ui-kit/tabs-ui/src/use-tabs-view-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ export function useTabsViewScroll(props: TabsProps) {

function handleWheel({ deltaY }: WheelEvent) {
scrollViewportEl.value?.scrollBy({
// behavior: 'smooth',
left: deltaY,
behavior: 'smooth',
left: deltaY * 3,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ const styleItems = computed((): SelectOption[] => [
<SwitchItem v-model="tabbarDraggable" :disabled="!tabbarEnable">
{{ $t('preferences.tabbar.draggable') }}
</SwitchItem>
<SwitchItem v-model="tabbarWheelable" :disabled="!tabbarEnable">
<SwitchItem
v-model="tabbarWheelable"
:disabled="!tabbarEnable"
:tip="$t('preferences.tabbar.wheelableTip')"
>
{{ $t('preferences.tabbar.wheelable') }}
</SwitchItem>
<SwitchItem v-model="tabbarShowIcon" :disabled="!tabbarEnable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ defineOptions({
name: 'PreferenceSwitchItem',
});
withDefaults(defineProps<{ disabled?: boolean }>(), {
withDefaults(defineProps<{ disabled?: boolean; tip?: string }>(), {
disabled: false,
tip: '',
});
const checked = defineModel<boolean>();
Expand All @@ -32,11 +33,17 @@ function handleClick() {
<span class="flex items-center text-sm">
<slot></slot>

<VbenTooltip v-if="slots.tip" side="bottom">
<VbenTooltip v-if="slots.tip || tip" side="bottom">
<template #trigger>
<CircleHelp class="ml-1 size-3 cursor-help" />
</template>
<slot name="tip"></slot>
<slot name="tip">
<template v-if="tip">
<p v-for="(line, index) in tip.split('\n')" :key="index">
{{ line }}
</p>
</template>
</slot>
</VbenTooltip>
</span>
<span v-if="$slots.shortcut" class="ml-auto mr-2 text-xs opacity-60">
Expand Down
1 change: 1 addition & 0 deletions packages/locales/src/langs/en-US/preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"persist": "Persist Tabs",
"draggable": "Enable Draggable Sort",
"wheelable": "Support Mouse Wheel",
"wheelableTip": "When enabled, the Tabbar area responds to vertical scrolling events of the scroll wheel.",
"styleType": {
"title": "Tabs Style",
"chrome": "Chrome",
Expand Down
3 changes: 2 additions & 1 deletion packages/locales/src/langs/zh-CN/preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"showMaximize": "显示最大化按钮",
"persist": "持久化标签页",
"draggable": "启动拖拽排序",
"wheelable": "启用鼠标滚轮响应",
"wheelable": "启用纵向滚轮响应",
"wheelableTip": "开启后,标签栏区域可以响应滚轮的纵向滚动事件。\n关闭时,只能响应系统的横向滚动事件(需要按下Shift再滚动滚轮)",
"styleType": {
"title": "标签页风格",
"chrome": "谷歌",
Expand Down

0 comments on commit 80c8528

Please sign in to comment.