文章詳情頁
javascript - vuerouter2使用router.go一直在刷新
瀏覽:151日期: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. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””2. docker-compose中volumes的問題3. boot2docker無法啟動4. nignx - docker內nginx 80端口被占用5. docker安裝后出現Cannot connect to the Docker daemon.6. dockerfile - 為什么docker容器啟動不了?7. java - SSH框架中寫分頁時service層中不能注入分頁類8. node.js - antdesign怎么集合react-redux對input控件進行初始化賦值9. 關于docker下的nginx壓力測試10. docker容器呢SSH為什么連不通呢?
排行榜

網公網安備