浏览器恢复滚动行为
const scrollRestore = history.scrollRestoration

查看当前页面滚动恢复行为

const scrollRestoration = history.scrollRestoration
if (scrollRestoration === 'manual') {
  console.log('The location on the page is not restored, user will need to scroll manually.');
}

自动恢复页面位置

history.scrollRestoration && (history.scrollRestoration = 'auto')

防止自动恢复页面位置

if (history.scrollRestoration) {
  history.scrollRestoration = 'manual';
}