storage.js 497 B

1234567891011121314151617
  1. import Vue from 'vue'
  2. import { getStorage, setStorage } from '@/utils/storage'
  3. Vue.prototype.$setStorage = (type, key, value, options) => {
  4. type = type.slice(1).replace('/', '_')
  5. setStorage(`${type}_${key}`, value, options)
  6. }
  7. Vue.prototype.$getStorage = (type, key) => {
  8. type = type.slice(1).replace('/', '_')
  9. return getStorage(`${type}_${key}`)
  10. }
  11. Vue.prototype.$removeStorage = (type, key) => {
  12. type = type.slice(1).replace('/', '_')
  13. localStorage.removeItem(`zp_${type}_${key}`)
  14. }