How to obtain the history record of spa application vue-router

now there is such a page jump order a-> b-> c , so I can go back to the a page directly $router.go (- 2) on the c page.
if there are several page jumps in the middle, such as a-> e-> f-> c , then I need $router.go (- 3) to return to the a page on the c page.
so you should need to get the index of the page a in the history record dynamically. How can you get the index of the specified path in the history record, not necessarily vue-router native implementation, with the help of other modules can also


is also based on history . If you can't get the index, of the current route, you can get the total length of history.
you can record each routing information locally, and then jump as much as you want, wherever you want.


has God figured out how to deal with it? Now I also have the same requirement from a-> b-> c-> d. Now the page is suddenly closed, and then when I reopen the page, I have to automatically go to d. There is no love for such a need.


// route
// beforeRouteUpdate
  beforeRouteEnter(to, from, next) {
    this.fromPage = from
    console.log(from)
    next()
  },

if you want to get all the history records, you can only add this navigation guard in the outermost component and save it one by one in storage. I hope it can help you

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-1e891ba-46cf4.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-1e891ba-46cf4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?