【Vue】匹配404错误
在路由规则中, * 代表的是任意字符。所以只要在路由的最后添加一个 * 路由,那么以后没有匹配到的 url 都会被导入到这个视图中。示例代码如下: let UserProfile = {template:"<h1>个人中心:{{$route.params.userid}}</h1>"}; let NotFound = {template: "<h1>您找的页面已经到火星啦!</h1>"} var routes = [ {path: "/user/:userid",component: UserProfile}, {path: "*",component: NotFound}, ] 来源: CSDN 作者: 交大彭于晏 链接: https://blog.csdn.net/weixin_42191575/article/details/104626029