File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -5,18 +5,17 @@ import { useRouter } from "vue-router";
5
5
6
6
import { computed , ref } from " vue" ;
7
7
8
- // const router = useRouter();
8
+ const router = useRouter ();
9
9
const selectedId = ref (0 );
10
10
11
11
const expanded = useLocalStorage (" vue-forge-drawer-expanded" , true );
12
12
const expandedIcon = computed (() =>
13
13
expanded .value ? " k-i-arrow-chevron-left" : " k-i-arrow-chevron-right"
14
14
);
15
15
const items = computed (() => [
16
- {
16
+ {
17
17
text: " Boards" ,
18
18
icon: " k-i-set-column-position" ,
19
- selected: true ,
20
19
data: {
21
20
path: " /" ,
22
21
},
@@ -42,10 +41,15 @@ const items = computed(() => [
42
41
action : () => (expanded .value = ! expanded .value ),
43
42
},
44
43
},
45
- ]);
44
+ ].map ((item , index ) => ({
45
+ ... item ,
46
+ selected: index === selectedId .value ,
47
+ }))
48
+ );
46
49
47
50
function onSelect({ itemIndex }: { itemIndex: number }) {
48
51
const item = items .value [itemIndex ];
52
+ selectedId .value = itemIndex ;
49
53
if (item .data .path ) router .push (item .data .path );
50
54
if (typeof item .data .action === " function" ) item .data .action ();
51
55
}
You can’t perform that action at this time.
0 commit comments