Vue · Junior · Question 70 of 75
How do you define a catch-all 404 route in Vue Router 4?
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound }- ✓Correct answer: Use a param with a custom regex like
/:pathMatch(.*)* - 2Use
path: '*' - 3Vue Router shows a 404 automatically
Explanation
The old * syntax from Vue Router 3 was removed. Matched segments are available in route.params.pathMatch.