Setting up Vue Router with lazy loading and eager loading
To navigate to the pages we created, we have to register in routes some paths pointing to their respective components. In that case, let's go to the router/index.js
file to update it:
- We will update the paths of the Home page and About page because we'll move them into a new folder, which is
views/Main/
:import Vue from "vue"; import VueRouter from "vue-router"; import Home from "@/views/Main/Home"; import TourLists from "@/views/AdminDashboard/TourLists"; import TourPackages from "@/views/AdminDashboard/TourPackages"; Vue.use(VueRouter); const routes = [ { path: "/", name: "Home", component: Home }, /* lazy loading through dynamic import() */ { path: "/about", name: "About", component: () => import("@/views/Main/About") }, { path: "...