代码如下
没有最后一行的时候正常,只是想进来的时候,默认在goods页面,但是页面一直在跳转,不知道是什么问题。看vuerouter的文档没有发现,想默认选中一个该用什么api
代码如下
没有最后一行的时候正常,只是想进来的时候,默认在goods页面,但是页面一直在跳转,不知道是什么问题。看vuerouter的文档没有发现,想默认选中一个该用什么api
vue-router 中的 router的设计模式是参考了浏览器的window.history相关API
同history.go, router.go接受的参数应该为Number, 例如:
// 上一页
history.go(-1)
router.go(-1)
而你应该使用的是 router.push
routes中增加一个当前默认页对象:
const routes = [{
path: '/', component: Goods
},{
path: '/goods', component: Goods
},{
path: '/seller', component: Seller
},{
path: '/ratings', component: Ratings
}];
10 回答11.2k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.8k 阅读✓ 已解决
2 回答4.8k 阅读✓ 已解决
4 回答4.4k 阅读✓ 已解决
4 回答1.9k 阅读✓ 已解决
重定向
http://router.vuejs.org/zh-cn...