天天看點

Vue-router cannot read property _c of undefinedVue-router Exception

Vue-router Exception

當點選“商品”标簽的時候,consolse(控制台)跳出

cannot read property _c of undefined的異常

Vue-router cannot read property _c of undefinedVue-router Exception

此時觀察你的main.js中routes添加元件的時候:

和path相對應的一定是component,不是components,正确答案如下

const routes = [
  {path: '/goods', component: goods},
  {path: '/ratings', component: ratings},
  {path: '/sellers', component: sellers}
];
           

而不是

const routes = [
  {path: '/goods', components: goods},
  {path: '/ratings', components: ratings},
  {path: '/sellers', components: sellers}
];
           

希望能幫到你