vue-web | vue localstorage
AminimalisticVue.jspluginforwebstorageFeaturesChooseeitherlocalStorageorsessionStorageorbothPrefixallofyourstoredkeysAutoJSON.stringifyandJSON.parseEventsforcrosstabcommunicationInstallationyarn add vue-web-storage npm install vue-web-storage --saveUsageimport Vue from vue;import Storage from vue-web-storage; Vue.use(Storage); Configuration(optional)Vue.use(Storage, { prefix: your_app_slug_, drivers: [session,local], }); MethodsAllmethodstakescareofprefixinkeyname,soyounoneedtospecifykeyp...
A minimalistic Vue.js plugin for web storage
Features Choose either localStorage or sessionStorage or both Prefix all of your stored keys Auto JSON.stringify and JSON.parse Events for cross tab communication Installationyarn add vue-web-storage
npm install vue-web-storage --save
Usageimport Vue from vue;
import Storage from vue-web-storage;
Vue.use(Storage);
Configuration (optional)Vue.use(Storage, {
prefix: your_app_slug_,
drivers: [session,local],
});
Methods
All methods takes care of prefix in key name, so you no need to specify key prefix when using them.
set(key,value)Stores the value under specified key in storage. Convert value to JSON before saving. Returns true on success and false on errors.
Vue.$localStorage.set(name, john)
Vue.$localStorage.set(isAdmin, true)
Vue.$localStorage.set(roles, [admin, sub-admin])
Vue.$localStorage.set(permis...