您的位置:首頁技術文章
文章詳情頁

javascript - vue-router路由跳轉到其他地址,如何不保留歷史記錄

瀏覽:111日期: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是不是為其他網址.是的話返回第一個頁面.

回答2:

window.location.replace()

回答3:

this.$router.replace()

標簽: JavaScript
国产综合久久一区二区三区