文章詳情頁
javascript - vuerouter2使用router.go一直在刷新
瀏覽:83日期:2023-09-28 13:16:44
問題描述
代碼如下
沒有最后一行的時候正常,只是想進來的時候,默認在goods頁面,但是頁面一直在跳轉,不知道是什么問題。看vuerouter的文檔沒有發現,想默認選中一個該用什么api
問題解答
回答1:{ path: ’/’, component: Goods},
回答2:重定向
http://router.vuejs.org/zh-cn...
回答3:routes中增加一個當前默認頁對象:
const routes = [{ path: ’/’, component: Goods},{ path: ’/goods’, component: Goods},{ path: ’/seller’, component: Seller},{ path: ’/ratings’, component: Ratings}];回答4:
vue-router 中的 router的設計模式是參考了瀏覽器的window.history相關API
同history.go, router.go接受的參數應該為Number, 例如:
// 上一頁history.go(-1)router.go(-1)
而你應該使用的是 router.push
標簽:
JavaScript
相關文章:
1. html5 - ElementUI table中el-table-column怎么設置百分比顯示。2. python - 使用readlines()方法讀取文件內容后,再用for循環遍歷文件與變量匹配時出現疑難?3. 對mysql某個字段監控的功能4. css3 - less或者scss 顏色計算的知識應該怎么學?或者在哪里學?5. 注冊賬戶文字不能左右分離6. javascript - table列過多,有什么插件可以提供列排序和選擇顯示列的功能7. css - 網頁div區塊 像蘋果一樣可左右滑動 手機與電腦8. javascript - 數組的過濾和渲染9. html - vue項目中用到了elementUI問題10. JavaScript事件
排行榜
