RobinCK / vue-ls

:boom: Vue plugin for work with local storage, session storage and memory storage from Vue context 🇺🇦
https://robinck.gitbooks.io/vue-storage/
MIT License
536 stars 42 forks source link

How to use `sesstionStorage` and `localStorage` at the same time #134

Closed youcanping closed 5 years ago

youcanping commented 5 years ago

How to use sesstionStorage and localStorage at the same time

RobinCK commented 5 years ago
import Vue from 'vue';
import Storage from 'vue-ls';

if (process.client) {
    Vue.use(Storage, {
        namespace: 'mapr__',
        name: 'ls',
        storage: 'local',
    });

    Vue.use(Object.assign({}, Storage), {
        namespace: 'mapr__',
        name: 'ses',
        storage: 'session',
    });

}