1. Web page module division
Create a new folder in the src directory named views, create a new file in the views folder, and end with .vue
under the component
2. Routing configuration and use
The role of routing
Adaptation of the URL address and the page (changing the web page address will also change)
install command
npm install vue-router@next --save
Create a new routing file routes.ts in the src directory, press the right button to write the code block into the page and the routing mapping relationship
Create a new file routes in the src directory
Import the package and write down the corresponding path in this file
Note: All modules must be exported if they are imported, otherwise an error will be reported export default router
Then write the code in the main function to use routing
import router from './routes' import route
app.use(router) uses routing
Introduce <router-view></router-view> in App.vue