How can pages opened by localtion.href in a vue project be cached by router?

Project is an H5 page, nested in Mini Program

A page is a list loaded at the bottom of the scroll

B page is a detail page

When the

A page clicks on an item, use location.href ="/ b"to jump to page B
(because when Mini Program uses the forwarding feature, he can only use location.href to get the shared content)

so far there is no problem.
there is a requirement below that the B page clicks the back button to return to the location you browsed before page A. Then there is a problem. Page B uses router.back (- 1), jumping to page An is a new request, and keep-alive is useless. I would like to ask how this situation can read the cache of the A page.


the idea is to store the number of pages and scrolling height of the A page before jumping to the details page, and use js to scroll to the original location when returning from the details page.

provide a help link: detail page returns how the list page records the user's browsing location and updates the detail view

Menu