chore: update examples header
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -3,25 +3,27 @@ import { useRoute, useRouter } from 'vue-router'
|
|||||||
import { routes } from './router'
|
import { routes } from './router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const onChange = (event: Event) => {
|
const onChange = (event: Event) => {
|
||||||
router.push((event.target as HTMLSelectElement).value)
|
router.push((event.target as HTMLSelectElement).value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const computedRoutes = computed(() => {
|
const computedRoutes = computed(() =>
|
||||||
return routes
|
routes
|
||||||
.filter((r) => r.path !== '/')
|
.filter((r) => r.path !== '/')
|
||||||
.map((r) => ({
|
.map((r) => ({
|
||||||
path: r.path,
|
path: r.path,
|
||||||
label: r.path.substring(1),
|
label: r.path.substring(1),
|
||||||
}))
|
})),
|
||||||
})
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header>
|
<header>
|
||||||
<a class="logo" href="https://github.com/bcakmakoglu/vue-flow"> Vue Flow Dev </a>
|
<a class="logo" href="https://github.com/bcakmakoglu/vue-flow"> Vue Flow Dev </a>
|
||||||
<select v-model="route.path" @change="onChange">
|
<select :value="route.path" @change="onChange">
|
||||||
<template v-for="r of computedRoutes" :key="r.path">
|
<template v-for="r of computedRoutes" :key="r.path">
|
||||||
<option :value="r.path">
|
<option :value="r.path">
|
||||||
{{ r.label }}
|
{{ r.label }}
|
||||||
|
|||||||
Reference in New Issue
Block a user