当前位置: 首页 > Web前端 > vue.js

在nuxt3自定义路由

时间:2023-04-01 10:43:49 vue.js

根目录下创建app/router.options.js文件router.options.js如下constcustomRoutes=[{name:'home',path:'/',component:()=>import('../pages/Home.vue')},{name:'about',path:'/about1',component:()=>import('../pages/About.vue')},]exportdefault{routes:(_routes)=>[..._routes,...customRoutes]}_routes是系统内置的,解构后放入数组即可,customRoutes可以自定义编辑你的路由