-
Notifications
You must be signed in to change notification settings - Fork 61
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
Storage of object as [object Object] #36
Comments
Hello there. You should provide ls variable type in localStorage section of Vue instance or call get/set methods with third parameter which allows to provide dynamic variable type: Vue.localStorage.get('property', null, Object)
Vue.localStorage.set('property', { hey: 'there' }, Object) |
我也遇到了该问题,去查看原型链,发现set方法没有第三个参数,下面是我的解决方式 |
@shanghen you're trying to access private property. Yes, you can, but it's wrong from view of js naming agreements. I'll implement third parameter ASAP. Be welcome to make a PR ;) |
Is it implemented already?
And it doesn't work for me, unfortunately. Of course, following code works for me, but it looks for me overcomplex and force me to define a preperty each time i want to use it.
Can't it (try to) detect type of value automatically?
That code will overwrite "user" value instead of extend it Do you have any clear plans for it? Thank you! |
@mikkiek I think the best way to implement it - forget about providing a type and use I don't think that data merge is expected behavior. |
@pinguinjkeke Thank you for your advices. |
Use ._lsSet() instead of using .set() |
What is the essence of the package if we have to do this? |
When storing object directly, it only store as [object Object].
Should we json encode before store?
The text was updated successfully, but these errors were encountered: