I am developing an application SPA with Vue.js and I realized that when I call imports to load the routes using Vue-router it is loading everything.
My current code:
import Home from './components/Home/Home.vue';
import Product from './components/Product/Index.vue';
import Participant from './components/Participant/Index.vue';
export const routes = [
{
path: '',
component: Home,
name: 'home',
comments: {
default: Home
}
},
{
path: '/product', component: Product
},
{
path: '/participant', component: Participant
},
{ path: '*', redirect: '/' }
];
I was wondering if is there anything to load just part of the screen in order to be a truly SPA, I mean when it receives a click on the menu.
My menu code:
<router-link class="nav-item" tag="li" to="/"><a class="nav-link">Home</a></router-link>
<router-link class="nav-item" tag="li" to="/product"><a class="nav-link">Product</a></router-link>
<router-link class="nav-item" tag="li" to="/participant"><a class="nav-link">Participant</a></router-link>