58网站建设多少钱,网站建设的元素,微信网站开发教程视频教程,app下载链接前些天发现了一个巨牛的人工智能学习网站#xff0c;通俗易懂#xff0c;风趣幽默#xff0c;忍不住分享一下给大家。点击跳转到教程。
vue项目原本是用0.x版本的vue-router#xff0c;但是去报出#xff1a;Cannot read property component of undefined
这是因为版本问…前些天发现了一个巨牛的人工智能学习网站通俗易懂风趣幽默忍不住分享一下给大家。点击跳转到教程。
vue项目原本是用0.x版本的vue-router但是去报出Cannot read property component of undefined
这是因为版本问题由于vue2删除了vue1的内部指令而vuerouter1.x依赖vue的一个内部指令
研究了下vue-router官网小白我用了接近一天来解决问题最后我将vue-router改为2.2.0版本
1.打开package.json 将dependencies中的 vue-router版本改为^2.2.0
2.执行
npm install
3.在App.vue中 a v-link{path:/goods}/a
改为 router-link to/goods商品/router-link
4.然后在main.js中我的main.js是这样的【2.2.0版本】
import Vue from vue; import VueRouter from vue-router; import App from ./App; import goods from ./components/goods/goods; import seller from ./components/seller/seller; import ratings from ./components/ratings/ratings; //使用模块化机制编程導入Vue和VueRouter要调用 Vue.use(VueRouter) Vue.use(VueRouter);
//定义路由 var routes[ {path:/,redirect: /goods}, {path:/goods,component:goods}, {path:/ratings,component:ratings}, {path:/seller,component:seller} ]
//创建 router 实例然后传 routes 配置 var routernew VueRouter({ linkActiveClass: active, routes }); // 是ES6的箭头语法 new Vue({ el:#app, router, render:hh(App) })
vue-router官网https://router.vuejs.org --------------------- 转自https://blog.csdn.net/m0_37754657/article/details/71269988