当切换到新路由时想要页面保持原先的滚动位置,没有达到预期效果
Opened this issue · 2 comments
cestrongly commented
Describe the bug
router.beforeResolve:
history.replaceState({ ...history.state, [STATE_KEY]: pos }, ""); 存储的对象
在 router.afterEach:中没能取到值
const pos = history.state[STATE_KEY] || positionsMap.get(key);
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.
l246804 commented
+1
t596502 commented
+1