vue-simple
Version:
Use Vue in the simplest and easiest way, contain more than one of plugins and other to do that, i hope you will like it.
23 lines (21 loc) • 429 B
JavaScript
import STORAGE_TYPE from '../storageType';
/**
* map memory 存储引擎
* <p>作为不支持 sessionstorage 的降级支持方案</p>
*/
export default {
type: STORAGE_TYPE.memory,
storage: new Map(),
getItem(key) {
return this.storage.get(key);
},
setItem(key, value) {
this.storage.set(key, value);
},
removeItem(key) {
this.storage.delete(key);
},
clear() {
this.storage.clear();
}
};