window.history.length 就是記錄你當前的頁面進行了多少次訪問,當window.history.length等於1的時候就說明已經不能進行回退了,所以在回退的時候可以這樣判斷
goBack() { window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/') },
但好像當length達到50的時候 長度就不會再增加了
window.history.length 就是記錄你當前的頁面進行了多少次訪問,當window.history.length等於1的時候就說明已經不能進行回退了,所以在回退的時候可以這樣判斷
goBack() { window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/') },
但好像當length達到50的時候 長度就不會再增加了
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。