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 }

Explanation

The old * syntax from Vue Router 3 was removed. Matched segments are available in route.params.pathMatch.

Further reading

Problem with a question

Vue · Junior · question 70

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz