VueLocalStorage

localStorage plugin with types support for Vue.js and Vue.js 2.
Install
npm install vue-localstorage --save
or
bower install vue-localstorage
Usage
import VueLocalStorage from 'vue-localstorage'
Vue.use(VueLocalStorage)
Vue.$localStorage.set('someNumber', 123)
Vue.$localStorage.get('someNumber')
Vue.$localStorage.get('propertyThatNotExists', 'fallbackValue')
var vm = new Vue({
localStorage: {
someObject: {
type: Object,
default: {
hello: 'world'
}
},
someNumber: {
type: Number,
},
someBoolean: {
type: Boolean
},
stringOne: '',
stringTwo: {
type: String,
default: 'helloworld!'
},
stringThree: {
default: 'hello'
}
},
methods: {
someMethod () {
let lsValue = this.$localStorage.get('someObject')
this.$localStorage.set('someBoolean', true)
this.$localStorage.remove('stringOne')
}
}
})
License
[MIT]