代码如下
没有最后一行的时候正常,只是想进来的时候,默认在goods页面,但是页面一直在跳转,不知道是什么问题。看vuerouter的文档没有发现,想默认选中一个该用什么api
学习是最好的投资!
{ 路徑: '/', 組件: 商品},
重定向
http://router.vuejs.org/zh-cn...
routes中增加一個目前預設頁物件:
const routes = [{ path: '/', component: Goods },{ path: '/goods', component: Goods },{ path: '/seller', component: Seller },{ path: '/ratings', component: Ratings }];
vue-router 中的 router的設計模式是參考了瀏覽器的window.history相關API
同history.go, router.go接受的參數應為Number, 例如:
// 上一页 history.go(-1) router.go(-1)
而你應該使用的是 router.push
{ 路徑: '/', 組件: 商品},
重定向
http://router.vuejs.org/zh-cn...
routes中增加一個目前預設頁物件:
vue-router 中的 router的設計模式是參考了瀏覽器的window.history相關API
同history.go, router.go接受的參數應為Number, 例如:
而你應該使用的是 router.push