File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -3,25 +3,27 @@ import { useRoute, useRouter } from 'vue-router'
33import { routes } from ' ./router'
44
55const router = useRouter ()
6+
67const route = useRoute ()
8+
79const onChange = (event : Event ) => {
810 router .push ((event .target as HTMLSelectElement ).value )
911}
1012
11- const computedRoutes = computed (() => {
12- return routes
13+ const computedRoutes = computed (() =>
14+ routes
1315 .filter ((r ) => r .path !== ' /' )
1416 .map ((r ) => ({
1517 path: r .path ,
1618 label: r .path .substring (1 ),
17- }))
18- } )
19+ })),
20+ )
1921 </script >
2022
2123<template >
2224 <header >
2325 <a class =" logo" href =" https://github.com/bcakmakoglu/vue-flow" > Vue Flow Dev </a >
24- <select v-model =" route.path" @change =" onChange" >
26+ <select :value =" route.path" @change =" onChange" >
2527 <template v-for =" r of computedRoutes " :key =" r .path " >
2628 <option :value =" r.path" >
2729 {{ r.label }}
You can’t perform that action at this time.
0 commit comments