Home >Web Front-end >JS Tutorial >About the router-view method of routing in vue2.0 (detailed tutorial)
Below I will share with you a solution to the problem that vue2.0 routing does not display router-view. It has a good reference value and I hope it will be helpful to everyone.
Today I learned the router-view of vue2.0, and there were countless errors. I don’t know which master wrote router-view. The configured parameters were not routers, but routes =_=||
This is the main.js that took a whole morning to complete, and there are reminders from colleagues on the Internet:
import Vue from 'vue'; import VueRouter from 'vue-router'; import App from './App'; import goods from './components/goods/goods'; Vue.config.productionTip = false; Vue.use(VueRouter); const routes = [ {path: '/goods', component: goods} ]; const router = new VueRouter({ routes }); /* eslint-disable */ const app = new Vue({ router, render: h => h(App) }).$mount('#app'); //默认跳转到 '/goods' router.push('/goods');
Here/* eslint-disable */ is the eslint code check. If you don’t add this, an error will be reported that the app is not used.
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
JQuery selects the selected value method of the select component
$set and array update method in vue.js_ vue.js
Vue and vue-i18n are combined to implement multi-language switching method of background data
The above is the detailed content of About the router-view method of routing in vue2.0 (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!