UNPKG

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.

25 lines (23 loc) 501 B
import STORAGE_TYPE from '../storageType'; /** * sessionStorage 存储引擎 */ export default { type: STORAGE_TYPE.sessionStorage, storage: sessionStorage || window.sessionStorage, getItem(key) { let r = this.storage.getItem(key); r = r ? JSON.parse(r) : r; return r; }, setItem(key, value) { value = JSON.stringify(value); this.storage.setItem(key, value); }, removeItem(key) { this.storage.removeItem(key); }, clear() { this.storage.clear(); } };