vue-ls
Vue plugin for work with LocalStorage from Vue context
Install
npm install vue-ls --save
or
yarn install vue-ls
Development Setup
npm install
npm run build
Usage
Vue localStorage API.
import VueLocalStorage from 'vue-ls';
Vue.use(new VueLocalStorage);
new Vue({
el: '#app',
mounted: function() {
this.$localStorage.set('foo', 'boo');
this.$localStorage.set('foo', 'boo', 60 * 60 * 1000);
this.$localStorage.get('foo');
this.$localStorage.get('boo', 10);
let callback = (val, oldVal, uri) => {
console.log('localStorage chnage', val);
}
this.$localStorage.on('foo', callback)
this.$localStorage.off('foo', callback)
this.$localStorage.remove('foo');
}
});