webpack中使用vue路由设置不报错,但是不能显示啊啊

设置好了vue路由,npm run dev一下,不报错,但是路由不生效啊
代码如下:

https://img1.mukewang.com/5c0a27f20001e8c805290674.jpg

慕运维8079593
浏览 741回答 1
1回答

慕田峪9158850

你没有贴App.vue中的代码 我不知道你写了没有Vue.use(Router)Vue.use(Vuex)export default new Router({&nbsp; routes: [&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; path: '/',&nbsp; &nbsp; &nbsp; component: App,&nbsp; &nbsp; &nbsp; redirect:'/in_theaters'},&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; path: '/in_theaters',&nbsp; &nbsp; &nbsp; component: in_theaters,&nbsp; &nbsp; },{&nbsp; &nbsp; &nbsp; path: '/coming_soon',&nbsp; &nbsp; &nbsp; component: coming_soon,&nbsp; &nbsp; },&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; path: '/top250',&nbsp; &nbsp; &nbsp; component: top250,&nbsp; &nbsp; },&nbsp; &nbsp; {&nbsp; &nbsp; path:'*',&nbsp; &nbsp; &nbsp; redirect:'/'&nbsp; &nbsp; }&nbsp; ]})配置完路由之后&nbsp;要在App.vue中引用路由路径 这个content 大概的意思就是这个地方加载 你的Home.vue&nbsp;&nbsp;<el-col&nbsp;&nbsp;&nbsp;:md="14"&nbsp;:lg="18"&nbsp;class="content">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<router-view></router-view> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</el-col>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript