File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 11<template >
22 <li >
33 <Link
4- :class =" {
5- [tw`bg-green-100 dark:bg-green-700 text-shamrock-900! dark:text-shamrock-100! rounded pointer-events-none `]:
6- currentRoute.fullPath === to
7- }"
8- classAppend =" inline-block w-full px-3 py-1.5"
4+ :classAppend =" [
5+ classes.BASE,
6+ currentRoute.fullPath === to ? classes.active : classes.inactive
7+ ]"
98 :to =" to"
10- styled
119 >
1210 <slot ></slot >
1311 </Link >
1412 </li >
1513</template >
1614
1715<script lang="ts">
18- import { defineComponent } from " vue" ;
16+ import { computed , defineComponent } from " vue" ;
1917import { tw } from " twind" ;
2018import Link from " @/views/components/Link.vue" ;
2119import router from " @/router/index.ts" ;
@@ -32,7 +30,14 @@ export default defineComponent({
3230 },
3331 setup() {
3432 const { currentRoute } = router ;
35- return { tw , currentRoute };
33+ const classes = computed (() => {
34+ return {
35+ BASE: ` inline-block w-full px-3 py-1.5 ` ,
36+ active: ` bg-green-500 dark:bg-green-700 text-white dark:text-shamrock-100! rounded pointer-events-none ` ,
37+ inactive: ` text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 ` ,
38+ };
39+ });
40+ return { tw , currentRoute , classes };
3641 },
3742});
3843 </script >
You can’t perform that action at this time.
0 commit comments