A
A
Anton2019-06-11 18:52:44
Vue.js
Anton, 2019-06-11 18:52:44

How to specify the path to a non-existent page?

Usually we specify paths to various pages in routes. How to specify the path to the page, in this case the error page, if the path specified by the user does not exist?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-06-11
@Toxa26

const routes = [
  ...
  {
    path: '*',
    component: Page404,
  },
];

or, you can additionally redirect:
const routes = [
  ...
  {
    path: '/404',
    component: Page404,
  },
  {
    path: '*',
    redirect: '/404',
  },
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question