After we have created the view, we need to add it to the router and make it available to the user. To do it, we will need to add the view route into the router manager.
In these steps, we will change the router manager, to add the new error page:
- Open index.js in the src/router folder.
- Import the NotFound component:
import Vue from 'vue';
import VueRouter from 'vue-router';
import UserRoutes from './user';
import NotFound from '@/views/NotFound';
- In the routes array, after UserRoutes, add a new route object with two properties, path and redirect. Define the path property as '/' and the redirect property as '/user':
{
path: '/',
redirect: '/user'
},
- For the not found page, we need to create a new route object that needs to be placed in the last position in the routes array. This route object will have two properties, path, and component. The path property will be defined as &apos...