Vue.js localStorage plugin with types support
Forgot to add new dist files to git
.get
method (Thanks to @nikolay-borzov for idea)parseFloat
instead of parseInt
for Numbers (Thanks to @baryon for idea)Thanks a lot for @dasdeck for great PR.
Now you can bind properties as computed to call them like this:
Vue.use(localStorage, { bind: true })
new Vue({
localStorage: {
someValue: {
default: 6,
type: Number
}
},
created () {
this.someValue // 6
this.somValue = 7 // Will write 7 to localStorage
}
})
You can use global config bind
property like:
Vue.use(localStorage, { bind: true })
or use it for properties you need to be bounded as computed:
new Vue({
localStorage: {
someValue: {
type: Number,
bind: true
}
}
})
Thanks to @noprom for bug hunting
get
method (see README)Fixed in-component localStorage behavior