Greetings! I am currently developing a website using Vue, but I have encountered an issue. Initially, I tried using router.go(-1) to prevent access through the address bar (e.g., from ../client/mypage to ../admin/mypage) and to redirect to the previous page. However, this approach did not work as planned because the page itself was getting refreshed, possibly due to an empty router history stack.
Subsequently, I attempted to use window.history.go(-1), but unfortunately, it also failed even though its length was greater than 1.
Could you please help me identify the problem and suggest a suitable solution?
mounted(){
if (this.auth) { // Check authority when accessing through the address
this.$router.go(-1); // Doesn't work
window.history.go(-1); // Also doesn't work
}
}