一、安裝
npm install storejs --save
二浆西、引入
import storeLocal from 'storejs';
Vue.prototype.$storeLocal = storeLocal;// 定義 localStorage 組件
三粉私、使用
this.$storeLocal.set('local_test',{'name':www,'age':2});
四、API
// 存儲(chǔ)變量到user鍵
store.set('user', { name:'Marcus' })
//獲取內(nèi)容
store.get('user')
// 刪除鍵
store.remove('user')
// 清除所有的鍵
store.clearAll()
// 循環(huán)顯示所有的鍵值對(duì)
store.eachEach(function(key, value) {
console.log(key, '==', value)
})