Home > Web Front-end > JS Tutorial > body text

Solve the problem that vue2.0 routing does not display router-view

php中世界最好的语言
Release: 2018-03-28 17:11:22
Original
4236 people have browsed it

This time I will bring you a solution to the problem of vue2.0routingnot displaying router-view, and a solution to the problem of vue2.0 routing not displaying router-viewWhat are the precautions? The following is a practical case, let’s take a look.

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 I spent all morning working on, and there are also 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');
Copy after login

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.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Routing permission management of Vue

##How to compress and merge JS files in node

The above is the detailed content of Solve the problem that vue2.0 routing does not display router-view. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
ie
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template