您的位置:首页 > 产品设计 > UI/UE

vue2.0填坑之--不显示router-view

2016-12-13 19:25 591 查看
Vue.use(VueRouter);

const routers = [
{path: '/goods', component: goods},
{path: '/ratings', component: ratings},
{path: '/seller', component: seller}
];
const router = new VueRouter({
linkActiveClass: 'active',
routers: routers               //是routes: xxx,而不是routers
});
/* eslint-disable no-new */
new Vue({
template: '<App/>',
components: { App },
router: router
}).$mount('#app');

router.push('/goods');

此处的new VueRouter的时候放进去的routers写错了,导致根本没有传组件进去.

new东西的时候应该看清楚文档,键值对中键一般都是严格规范的.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Vue