refactor: minor cleanup codes
This commit is contained in:
1 parent
e09aac4a2b
commit
689ef0488f
1 file changed
+23
-12
@@ -16,6 +16,23 @@ const handleRoute = (path: string): void => {
|
|||||||
const isCurrentRoute = (path: string): boolean => {
|
const isCurrentRoute = (path: string): boolean => {
|
||||||
return path === route.path
|
return path === route.path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const headerMenus: {
|
||||||
|
icon: string
|
||||||
|
text: string
|
||||||
|
path: string
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
icon: mdiHome,
|
||||||
|
text: 'title.main',
|
||||||
|
path: '/'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: mdiFitToScreenOutline,
|
||||||
|
text: 'title.second',
|
||||||
|
path: '/second'
|
||||||
|
}
|
||||||
|
]
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<v-app-bar
|
<v-app-bar
|
||||||
@@ -25,20 +42,14 @@ const isCurrentRoute = (path: string): boolean => {
|
|||||||
<v-app-bar-title>{{ t(titleKey) }}</v-app-bar-title>
|
<v-app-bar-title>{{ t(titleKey) }}</v-app-bar-title>
|
||||||
<template #append>
|
<template #append>
|
||||||
<v-btn
|
<v-btn
|
||||||
:prepend-icon="mdiHome"
|
v-for="menu in headerMenus"
|
||||||
|
:key="menu.path"
|
||||||
|
:prepend-icon="menu.icon"
|
||||||
variant="text"
|
variant="text"
|
||||||
:class="{ active: isCurrentRoute('/') }"
|
:class="{ active: isCurrentRoute(menu.path) }"
|
||||||
@click="handleRoute('/')"
|
@click="handleRoute(menu.path)"
|
||||||
>
|
>
|
||||||
{{ t('title.main') }}
|
{{ t(menu.text) }}
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
:prepend-icon="mdiFitToScreenOutline"
|
|
||||||
variant="text"
|
|
||||||
:class="{ active: isCurrentRoute('/second') }"
|
|
||||||
@click="handleRoute('/second')"
|
|
||||||
>
|
|
||||||
{{ t('title.second') }}
|
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
</v-app-bar>
|
</v-app-bar>
|
||||||
|
|||||||
Reference in new issue
Block a user