antfu/vue-router-better-scroller

当切换到新路由时想要页面保持原先的滚动位置,没有达到预期效果

Opened this issue · 2 comments

Describe the bug

router.beforeResolve:
history.replaceState({ ...history.state, [STATE_KEY]: pos }, ""); 存储的对象
在 router.afterEach:中没能取到值
const pos = history.state[STATE_KEY] || positionsMap.get(key);
cf4b31fc2383773297c295f22556040
891cad45e11f78c157ed1b1d71bd6c0

Reproduction

https://github.com/cestrongly/my-vue-app

System Info

- Windows 10 专业版
- Microsoft Edge 版本 114.0.1823.79 (正式版本) (64 位)
- Node v18.16.0pn
- pnpm v8.6.3

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

+1

+1