Skip to content

Commit 2837ee1

Browse files
authored
feat: close menu on navigation (#10)
1 parent ea64bac commit 2837ee1

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

src/App.vue

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
<script setup lang="ts">
2-
import { computed } from 'vue'
2+
import { computed, ref } from 'vue'
33
import { useRoute } from 'vue-router'
44
import { useStorage } from '@vueuse/core'
55
66
const toast = useToast()
77
const route = useRoute()
88
9+
const open = ref(false)
10+
911
const links = [[{
1012
label: 'Home',
1113
icon: 'i-lucide-house',
12-
to: '/'
14+
to: '/',
15+
onSelect: () => {
16+
open.value = false
17+
}
1318
}, {
1419
label: 'Inbox',
1520
icon: 'i-lucide-inbox',
1621
to: '/inbox',
17-
badge: '4'
22+
badge: '4',
23+
onSelect: () => {
24+
open.value = false
25+
}
1826
}, {
1927
label: 'Customers',
2028
icon: 'i-lucide-users',
21-
to: '/customers'
29+
to: '/customers',
30+
onSelect: () => {
31+
open.value = false
32+
}
2233
}, {
2334
label: 'Settings',
2435
to: '/settings',
@@ -27,16 +38,28 @@ const links = [[{
2738
children: [{
2839
label: 'General',
2940
to: '/settings',
30-
exact: true
41+
exact: true,
42+
onSelect: () => {
43+
open.value = false
44+
}
3145
}, {
3246
label: 'Members',
33-
to: '/settings/members'
47+
to: '/settings/members',
48+
onSelect: () => {
49+
open.value = false
50+
}
3451
}, {
3552
label: 'Notifications',
36-
to: '/settings/notifications'
53+
to: '/settings/notifications',
54+
onSelect: () => {
55+
open.value = false
56+
}
3757
}, {
3858
label: 'Security',
39-
to: '/settings/security'
59+
to: '/settings/security',
60+
onSelect: () => {
61+
open.value = false
62+
}
4063
}]
4164
}], [{
4265
label: 'Feedback',
@@ -95,6 +118,7 @@ if (cookie.value !== 'accepted') {
95118
<UDashboardSearch :groups="groups" />
96119

97120
<UDashboardSidebar
121+
v-model:open="open"
98122
collapsible
99123
resizable
100124
class="bg-(--ui-bg-elevated)/25"

0 commit comments

Comments
 (0)