// 透過模板路由配置 import { createRouter, createWebHistory } from "vue-router"; // 建立路由器 const routes = [ // 登入路由 { path: "/login", component: () => import("../views/login/index.vue"), name: "login", //命名路由 }, //登入成功後展示資料的路由 { path: "/", component: () => import("../views/home/index.vue"), name: "layout", }, { path: "/404", component: () => import("../views/noFound/index.vue"), name: "any", }, { path:'/:pathMatch(.*)', redirect : '/404', } ]; const router = createRouter({ history: createWebHistory(), routes, // scrollBehavior(){ // return { // left:0, // top:0 // } // } }); export default router