File tree 2 files changed +13
-13
lines changed
2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
const isOpen = ref (false )
3
3
const navigation = useNavigationStore ()
4
+
5
+ // const route = useRoute()
6
+ watch (useRoute (), () => (isOpen .value = false ))
4
7
</script >
5
8
6
9
<template >
@@ -68,19 +71,16 @@ const navigation = useNavigationStore()
68
71
<the-sidebar-navigation
69
72
:navigation =" navigation.mainNavigation"
70
73
section-name =" Introduction"
71
- @on-click =" isOpen = false"
72
74
/>
73
75
74
76
<the-sidebar-navigation
75
77
:navigation =" navigation.cheatsheetNavigation"
76
78
section-name =" Cheatsheet"
77
- @on-click =" isOpen = false"
78
79
/>
79
80
80
81
<the-sidebar-navigation
81
82
:navigation =" navigation.standardLibraryNavigation"
82
83
section-name =" Standard Library"
83
- @on-click =" isOpen = false"
84
84
/>
85
85
</nav >
86
86
</nav >
Original file line number Diff line number Diff line change @@ -5,18 +5,18 @@ interface Navigation {
5
5
[key : string ]: any
6
6
}
7
7
8
- const emit = defineEmits ([' on-click' ])
8
+ // const emit = defineEmits(['on-click'])
9
9
10
10
defineProps <{
11
11
sectionName: string
12
12
navigation: Array <Navigation >
13
13
}>()
14
14
15
- const router = useRouter ()
16
- const navigate = (item : Navigation ) => {
17
- router .push (item .path )
18
- emit (' on-click' )
19
- }
15
+ // const router = useRouter()
16
+ // const navigate = (item: Navigation) => {
17
+ // router.push(item.path)
18
+ // emit('on-click')
19
+ // }
20
20
</script >
21
21
22
22
<template >
@@ -27,17 +27,17 @@ const navigate = (item: Navigation) => {
27
27
class =" mt-2 mb-6 space-y-2 border-l-2 border-slate-100 text-base dark:border-slate-800 lg:mt-4 lg:space-y-1.5 lg:border-slate-200 lg:text-sm"
28
28
>
29
29
<li v-for =" item in navigation" :key =" item.name" class =" relative" >
30
- <a
31
- class =" -ml-px block cursor-pointer border-l border-transparent pl-4 transition duration-150"
30
+ <router-link
31
+ :to =" item.path"
32
+ class =" -ml-px block border-l border-transparent pl-4 transition duration-150"
32
33
:class ="
33
34
$route.path === item.path
34
35
? 'border-current font-semibold text-sky-500 dark:text-sky-400'
35
36
: 'text-slate-700 hover:border-slate-400 hover:text-slate-900 dark:text-slate-400 dark:hover:border-slate-500 dark:hover:text-slate-300'
36
37
"
37
- @click =" navigate(item)"
38
38
>
39
39
{{ item.name }}
40
- </a >
40
+ </router-link >
41
41
</li >
42
42
</ul >
43
43
</template >
You can’t perform that action at this time.
0 commit comments