文章詳情頁
javascript - vue-router路由跳轉到其他地址,如何不保留歷史記錄
瀏覽:110日期:2022-12-15 10:14:22
問題描述
頁面路由配置了兩個
{ path: ’index’, name: ’introduce’, component: page.introduce,},{ path: ’detail’, name: ’detail’, component: page.detail,}
由先由index跳轉到detail, detail再跳轉其他地址如百度或者什么的,再點擊微信端的返回,如何直接返回到第一個頁面?
問題解答
回答1:跳到百度之后就不歸你管了.可以在你的路由或者組件里面判斷document.referrer是不是為其他網(wǎng)址.是的話返回第一個頁面.
回答2:window.location.replace()
回答3:this.$router.replace()
標簽:
JavaScript
排行榜

熱門標簽