Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Fixed bug: restore origin history state when set history. #456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dingyi1993
Copy link
Contributor

When you use vue router or some modules which will modify history state,smooth scroll will cover origin state,this pr will fix this problem.

smoothScroll: JSON.stringify(options),
anchor: hash ? hash : window.pageYOffset
};
if (history.state) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the bit above, but can you explain to me why this is needed?

Copy link
Contributor Author

@dingyi1993 dingyi1993 Jan 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at this screen shot below, this is a SPA which is using vue and vue router.

When I push a new route, history state will automatically set by vue router, if you just replace history state, vue router will not work correctly.

If you use react router or set some state by yourself, this has the same problem.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants