1.0.8 • Published 7 years ago
@pangjiaming/local_storage v1.0.8
local storage
一个处理localstorage的实用包。 链接: http://reng99.cc/local_storage/
使用方式一
安装
npm i @pangjiaming/local_storage --save在vue的工程项目中使用:
import { setAppointStore, getAppointStore, removeAppointStore, removeAllStore } from '@pangjiaming/local_storage'调用方法
// setAppointStore 存储指定的localstorage
setAppointStore({
key: 'name',
value: 'pangjiaming',
options: {
expiry: '1d', // 过期时间这里是一天,允许的值有天(d),小时(h),分钟(m),秒(s)
isRefresh: false, // 刷新的时候是否移除此条localstorage
}
})// @method getAppointStore 获取指定的键值对
getAppointStore({
key: 'name'
})// removeAppointStore 移除指定的键值
removeAppointStore({
key: 'name'
})// removeAllStore 移除所有的localstorage存储
removeAllStore()使用方式二
script标签引入
/dist/localstorage.js文件使用全局变量r调用暴露出来的接口:
// setAppointStore 存储指定的localstorage
r.setAppointStore({
key: 'name',
value: 'pangjiaming',
options: {
expiry: '1d', // 过期时间这里是一天,允许的值有天(d),小时(h),分钟(m),秒(s)
isRefresh: false, // 刷新的时候是否移除此条localstorage
}
})// @method getAppointStore 获取指定的键值对
r.getAppointStore({
key: 'name'
})// removeAppointStore 移除指定的键值
r.removeAppointStore({
key: 'name'
})// removeAllStore 移除所有的localstorage存储
r.removeAllStore()LICENSE
MIT