catch all RegExp
时间: 2024-01-05 21:04:15 浏览: 63
回答: 在Vue Router中,catch all routes(“*”)必须使用带有自定义正则表达式的参数进行定义。这是因为Vue Router不再使用path-to-regexp,而是实现了自己的解析系统,该系统允许路由排名并启用动态路由。由于每个项目通常都会添加一条单独的包罗万象的路线,因此支持的特殊语法没有太大的好处。参数的编码是跨路线编码,这使得事情更容易预测。在Vue3中,如果要配置404页面,必须使用正则表达式进行匹配。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* [ Catch all routes ("*") must now be defined using a param with a custom regexp....](https://blog.csdn.net/qq_34006340/article/details/130525630)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [Catch all routes (“*“) must now be defined using a param with a custom regexp](https://blog.csdn.net/Dawnchen1/article/details/116742166)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文