Q: did not return to the top of the page when switching pages under dva

Q: did not return to the top of the page when switching pages under dva

use window.scrollTo (0,0) in subscriptions; no effect, undefined.

window can be printed

backTop({ history }) {
      return history.listen(() => {
        console.log(window.scrollTo(0, 0))
        window.scrollTo(0, 0);
      });
    }

Update is not undefined, but still has no effect

Jul.02,2021

dva independent window.scrollTo (0,0) failure

previously found on the Internet is to remove the overflow-x: hidden; under body
but to no effect.
finally found that overflow-y: auto also needs to be removed

Menu