VUE—storejs一款好用的本地存储插件
作者:
大眼袋阿姨 | 来源:发表于
2020-01-08 10:55 被阅读0次
一、安装
npm install storejs --save
二、引入
import storeLocal from 'storejs';
Vue.prototype.$storeLocal = storeLocal;// 定义 localStorage 组件
三、使用
this.$storeLocal.set('local_test',{'name':www,'age':2});
四、API
// 存储变量到user键
store.set('user', { name:'Marcus' })
//获取内容
store.get('user')
// 删除键
store.remove('user')
// 清除所有的键
store.clearAll()
// 循环显示所有的键值对
store.eachEach(function(key, value) {
console.log(key, '==', value)
})
本文标题:VUE—storejs一款好用的本地存储插件
本文链接:https://www.haomeiwen.com/subject/icbjactx.html
网友评论