The vue routing change does not trigger the hashchange event.

problem description

recently, the project needs to listen for changes in vue routes. it is said on the Internet to use "hashchange" to monitor, but ordinary jumps cannot be triggered, only backward and forward can be triggered.

the environmental background of the problems and what methods you have tried

related codes

window.addEventListener("hashchange", function (e) { 
    console.log(e.oldURL);
    console.log(e.newURL)
  }, false)

what result do you expect? What is the error message actually seen?

1. Why didn"t "hashchange"? be triggered?
2. How does the external monitor the changes of a single page application page?


vue-router underlying calls are history.pushState and history.replaceState,. These two api updates to url are not limited to hash, and will not trigger hashchange

.

listeners can use vue-router navigation guards, or window.onpopstate

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34a73-2bf46.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34a73-2bf46.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?