To start our component, we will use the Vue project with Vue-CLI that we completed in the 'Creating a dynamic router path' recipe, or we can start a new one.
To start a new one, open Terminal (macOS or Linux) or Command Prompt/PowerShell (Windows) and execute the following command:
> vue create http-project
Choose the manual features and add router as a required feature, as indicated in the 'How to do it...' section of the 'Creating a simple route' recipe.
Now, in the following steps, we will create the router alias:
- Open index.js in the src/router folder.
- At the list object, we will change the path property from '/' to '/user' and for the alias property, we will set '/':
{
path: '/user',
name: 'list',
alias: '/',
component: List,
},
- In the view object, we will change the path property from '/view/:id' to '/user/:id' and we will set the alias property...