vue3-router-tab 1.4.2 β 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -2
- package/dist/vue3-router-tab.js +713 -635
- package/dist/vue3-router-tab.umd.cjs +1 -1
- package/index.d.ts +67 -82
- package/lib/components/RouterTab.vue +96 -25
- package/lib/core/createRouterTabs.ts +86 -29
- package/lib/core/types.ts +3 -0
- package/lib/index.ts +15 -6
- package/lib/useReactiveTab.ts +6 -0
- package/package.json +16 -7
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ A powerful, feature-rich Vue 3 tab-bar plugin that keeps multiple routes alive w
|
|
|
14
14
|
- π±οΈ **Context Menu** - Right-click tabs for refresh, close, and navigation options
|
|
15
15
|
- π **Drag & Drop** - Reorder tabs with drag-and-drop (sortable)
|
|
16
16
|
- πΎ **Cookie Persistence** - Restore tabs on page refresh with customizable options
|
|
17
|
+
- π **Sticky Routes** - Pin selected routes so they stay open and non-closable
|
|
17
18
|
- π **Theme Support** - Light, dark, and system themes with customizable colors
|
|
18
19
|
- β‘ **KeepAlive Support** - Preserve component state when switching tabs with smart cache management
|
|
19
20
|
- βΏ **Accessibility** - Full WCAG compliance with ARIA labels, keyboard navigation, and screen reader support
|
|
@@ -71,6 +72,32 @@ That's it! You now have a fully functional tabbed router interface.
|
|
|
71
72
|
</template>
|
|
72
73
|
```
|
|
73
74
|
|
|
75
|
+
### Sticky Tabs
|
|
76
|
+
|
|
77
|
+
Mark routes as sticky when you want them to stay pinned and non-closable:
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<template>
|
|
81
|
+
<router-tab
|
|
82
|
+
:sticky-tabs="true"
|
|
83
|
+
:keep-alive="true"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
{
|
|
90
|
+
path: '/dashboard',
|
|
91
|
+
component: Dashboard,
|
|
92
|
+
meta: {
|
|
93
|
+
title: 'Dashboard',
|
|
94
|
+
sticky: true,
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Set `:sticky-tabs="false"` to ignore sticky route metadata globally.
|
|
100
|
+
|
|
74
101
|
## π Usage Guide
|
|
75
102
|
|
|
76
103
|
### Basic Configuration
|
|
@@ -102,7 +129,7 @@ const routes = [
|
|
|
102
129
|
meta: {
|
|
103
130
|
title: 'Home',
|
|
104
131
|
icon: 'mdi-home',
|
|
105
|
-
|
|
132
|
+
sticky: true,
|
|
106
133
|
keepAlive: true,
|
|
107
134
|
},
|
|
108
135
|
},
|
|
@@ -871,7 +898,7 @@ const {
|
|
|
871
898
|
} = useReactiveTab({
|
|
872
899
|
title: () => `${user.value.name} - ${user.value.status}`,
|
|
873
900
|
icon: () => user.value.status === 'online' ? 'mdi-account' : 'mdi-account-off',
|
|
874
|
-
|
|
901
|
+
closable: () => user.value.status !== 'editing'
|
|
875
902
|
})
|
|
876
903
|
</script>
|
|
877
904
|
```
|
|
@@ -883,6 +910,23 @@ const {
|
|
|
883
910
|
3. **Automatic watching**: No manual watchers needed - the plugin handles everything
|
|
884
911
|
4. **Performance**: Only active tab components are watched to minimize overhead
|
|
885
912
|
|
|
913
|
+
#### Works inside KeepAlive and wrappers
|
|
914
|
+
|
|
915
|
+
`<router-tab>` forwards the tab bindings even when your pages are wrapped for caching. Just expose reactive values (refs/computed) and they will still be watched:
|
|
916
|
+
|
|
917
|
+
```vue
|
|
918
|
+
<script setup>
|
|
919
|
+
import { computed, ref } from 'vue'
|
|
920
|
+
|
|
921
|
+
const count = ref(3)
|
|
922
|
+
const isLoading = ref(false)
|
|
923
|
+
|
|
924
|
+
const routeTabTitle = computed(() => isLoading.value ? 'Loading ordersβ¦' : `Orders (${count.value})`)
|
|
925
|
+
const routeTabIcon = computed(() => isLoading.value ? 'mdi-loading mdi-spin' : 'mdi-cart')
|
|
926
|
+
const routeTabClosable = computed(() => !isLoading.value)
|
|
927
|
+
</script>
|
|
928
|
+
```
|
|
929
|
+
|
|
886
930
|
> π‘ **Try it yourself**: Check out the live demo at `/title-test` in the example app to see all these features in action!
|
|
887
931
|
|
|
888
932
|
### Options API Support
|