vue router报错

来源:互联网 发布:算法统宗以碗知僧 编辑:程序博客网 时间:2024/06/07 16:45

<router-view>

b6db:2611[Vue warn]: Unknown custom element:

 <router-link> -<router-view> did you register the component correctly? For recursive components, make sure to provide the "name" option. 

原因:自己把ROuter.js里面的一句话删了:

Vue.use(router);   这句话是把router挂载到Vue上的!不能删啊

/* eslint-disable no-new */这句话可以不要ESlint检查


import Vue from 'vue';
import Router from 'vue-router';
import Goods from '@/components/goods/goods';
import Ratings from '@/components/ratings/ratings';
import Seller from '@/components/seller/seller';
Vue.use(Router); // 把Router 加到Vue上


/* eslint-disable no-new */
export default new Router({
  routes: [
    {
      path: '/goods',
      name: 'goods',
      component: Goods
    },
    {
      path: '/ratings',
      name: 'ratings',
      component: Ratings
    },
    {
      path: '/seller',
      name: 'seller',
      component: Seller
    }
  ]
});