VueLocalStorage
LocalStorage plugin inspired by Vue typed props which take a care of typecasting for Vue.js 1 and 2 with SSR support.
Install
npm install vue-localstorage --save
or
bower install vue-localstorage
Usage
Vue// Or you can specify any other name and use it via this.$ls, this.$whatEverYouWantVue// Use localStorage from Vue objectVuelocalStorageVuelocalStorage// Fallback value if nothing found in localStorageVuelocalStorage // Will return 'fallbackValue' string// Default type if value isn't registered in localStorage sectionVuelocalStorage//register localStorage variables and adds computed variables to local components//to be used like regular computeds that are stored in the localstoragevar vm =localStorage:someObject:type: Objectdefault:hello: 'world'someNumber:type: NumbersomeBoolean:type: BooleanstringOne: ''stringTwo:type: Stringdefault: 'helloworld!'stringThree:default: 'hello'methods:{let lsValue = this$localStoragethis$localStoragethis$localStorage}
License
[MIT]