Vue3的版本404页面语法变更: Catch all routes ("*") must now be defined using a param with a custom regexp

zhuanbike 2022-3-22 1139

Vue3的版本中写通用匹配的路径*会报错: Catch all routes ("*") must now be defined using a param with a custom regexp。

必须使用正则来匹配路径:

{ path: '/:pathMatch(.*)', name: '/404', component: P404 },

很显然,Vue3的架构要比vue2更加严格和专业,代码质量也更高。

最新回复 (0)
发新帖