V
V
Valery V.2017-06-26 19:18:28
Vue.js
Valery V., 2017-06-26 19:18:28

How to make a 404 page in VUE.js?

Good evening!
The crux of the question is how to implement a 404 page through vue-router.
There are prescribed paths, and it is necessary that all urls that are not registered in the paths are redirected to the 404 page.
Even nothing comes to mind, I can’t find examples on the Internet, but I don’t understand Chinese yet).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yeldos Adetbekov, 2017-06-26
@OlegOleg1980

const routes = [
...
  { 
    path: '/404', 
    name: '404', 
    component: NotFound, 
  }, { 
    path: '*', 
    redirect: '/404' 
  }
]

S
serg127, 2018-10-17
@serg127

Hello.
And what's wrong with the approach from the official documentation, which was already mentioned above?
guide

const routes: [
    ...
    { path: "*", component: PageNotFound }
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question