Vue-router installation and configuration
Step one
Install the vue – the router:
npm install vue-router –save
Step 2
Vue. Use (VueRouter)
(2) Configure vUE routes
I deleted the index.js from the router folder, and then deleted the routing code from the js in main and manually configured it again.
Import VueRouter from 'vue-router' import vue from 'vue' //1 Install vue. use(VueRouter) via vue. use(plug-in); VueRouter const routes = [] const router = new VueRouter({routes}) // 3. Pass the Router object to the Vue instance Export Default RouterCopy the code
Then go to main.js to use the route
That’s the basic way to use it