v-web-storage

vue web storage

Usage no npm install needed!

<script type="module">
  import vWebStorage from 'https://cdn.skypack.dev/v-web-storage';
</script>

README

安装

npm install v-web-storage --save-dev

vue中使用

import storagePlugin from 'v-web-storage'
Vue.use(storagePlugin)

设置

this.$storage.local.set(key, val);
this.$storage.session.set(key, val);

获取

this.$storage.local.get(key);
this.$storage.session.get(key);

移除指定的一个

this.$storage.local.remove(key);
this.$storage.session.remove(key);

移除所有

this.$storage.local.clear();
this.$storage.session.clear();

是否有某个键

this.$storage.local.hasKey(key);
this.$storage.session.hasKey(key);