首页 > 其他 > 详细

初试 vue2.0——7.项目开发_路由重定向

时间:2017-02-28 18:06:40      阅读:185      评论:0      收藏:0      [点我收藏+]

写在前面的话:

  在vue1.0中的方式(貌似使用的是 go),在2.0中不太一样了。

做法:在index.js中,加入 redirect配置即可。

技术分享
 1 import Vue from ‘vue‘
 2 import Router from ‘vue-router‘
 3 import goods from ‘router/goods/goods‘
 4 import ratings from ‘router/ratings/ratings‘
 5 import seller from ‘router/seller/seller‘
 6 
 7 Vue.use(Router)
 8 
 9 export default new Router({
10   routes: [
11     {
12       path: ‘/‘,
13       redirect: ‘/goods‘,
14       component: goods
15     },
16     {
17       path: ‘/goods‘,
18       name: ‘goods‘,
19       component: goods
20     },
21     {
22       path: ‘/ratings‘,
23       name: ‘ratings‘,
24       component: ratings
25     },
26     {
27       path: ‘/seller‘,
28       name: ‘seller‘,
29       component: seller
30     }
31   ]
32 })
View Code

实例截图:

  技术分享

 

初试 vue2.0——7.项目开发_路由重定向

原文:http://www.cnblogs.com/Christeen/p/6479735.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!