vue3 路由文件配置
// 通过模板路由配置 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