В данный момент активный route - /notes
Рендерится соответствующий компонент, но урл не изменился:
Header.vue
<template>
<header class="header">
<div class="container">
<div class="header_inner">
<nav class="header_nav">
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/calculator">Calculator</RouterLink>
<RouterLink to="/notes">Notes</RouterLink>
</nav>
</div>
</div>
</header>
</template>
App.vue
<template>
<Header />
<RouterView :key="$route.fullPath"/>
</template>
<script>
import { RouterView } from 'vue-router'
import Header from '@/components/layout/Header.vue';
export default {
name: 'App',
components: {
"Header": Header
}
}
</script>
main.ts
import '@/assets/base.css'
import 'primevue/resources/themes/aura-light-green/theme.css'
import { createApp } from 'vue'
import PrimeVue from 'primevue/config'
import { router } from '@/router/index'
import App from '@/App.vue'
createApp(App).use(router).use(PrimeVue).mount('#app')
routes.ts
import { createMemoryHistory, createRouter } from 'vue-router'
import NotesPage from '@/pages/notes/NotesPage.vue'
import HomePage from '@/pages/home/HomePage.vue'
import CalculatorPage from '@/pages/calculator/CalculatorPage.vue'
const routes = [
{ path: '/', component: HomePage },
{ path: '/notes', component: NotesPage },
{ path: '/calculator', component: CalculatorPage }
]
export const router = createRouter({
history: createMemoryHistory(),
routes
})