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删除。