-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature: Data Store(before PR) #3452
Comments
That's a cool demo! Unfortunately, the router won't have an api to hold state like The thing you are trying to improve in v3 is already improved in v4 by using The |
|
Closing in favor of #3453 although it still needs to go through an RFC |
What problem does this feature solve?
#3445: vue-router positionStore memory leak
reconstruct
util/state-key
used
window.performance.now()
as the state key will reset when localtion reload, It may conflict with other hisotoriesWhat does the proposed API look like?
router.setData(key, data)
key
stringdata
anyrouter.getData(key)
key
stringrouter.removeData(key)
key
stringOnline Demo:
https://hezedu.github.io/SomethingBoring/vue-router-positionstore-memory-leak/pr-demo.html#/
Why adding these new features?
Unlike window.history, vue-router has no API to change history.state.
But sometimes we need it to store some unique keys, like the
positionStore
.So I replaced
positionStore
withdataStore
. This way you can store more things.And there is no need to develop
state
related APIs in the future.The text was updated successfully, but these errors were encountered: