vue-router In the configuration file, can I just write a * wildcard character
*
Then use this path to match all pages
Please give me some direction
业精于勤,荒于嬉;行成于思,毁于随。
匹配不到上面的就走这,是不是一个道理。 { path: '*', component: Page404 }
Update
/* 路由 vue-router api https://router.vuejs.org/zh-cn/essentials/dynamic-matching.html router 的懒加载(跳转对应路由时才加载对应页面的js) 1、import 只打包出对应的文件 2、require.ensure 可以把几个组件合在一起打包成一个js */ import Vue from 'vue' import Router from 'vue-router' const Page404 = () => import('@/pages/404') Vue.use(Router) export default new Router({ mode: 'history', // 服务器也要相对的配置,不然浏览器刷新后会找不到对应的页面 base: __dirname, routes: [ // 当以上路由都没有匹配成功,则跳转到404页面 { path: '*', component: Page404 } ] })
Facts have proved that it works to have one, no problem.
Update
Facts have proved that it works to have one, no problem.