In the following steps, we will create routes for the user:
- Create a new file called user.js in the src/router folder.
- Import the Index, List, View, Edit, and Create views:
import Index from '@/views/user/Index.vue';
import List from '@/views/user/List.vue';
import View from '@/views/user/View.vue';
import Edit from '@/views/user/Edit.vue';
import Create from '@/views/user/Create.vue';
- Create an array and make it the default export of the file. In this array, add a route object, with four properties – path, name, component, and children. Set the path property as '/user', define the name property as 'user', define component as the imported Index component, and finally, define the children property as an empty array:
export default [
{
path: '/user',
name: 'user',
component: Index,
children: [],
},
]
- In the children property, add a new route object with three properties...