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: "...