1.0.8 • Published 5 years ago

@pangjiaming/local_storage v1.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

npm.io npm.io Build Status

local storage

一个处理localstorage的实用包。 链接: http://reng99.cc/local_storage/

使用方式一

  1. 安装 npm i @pangjiaming/local_storage --save

  2. 在vue的工程项目中使用:import { setAppointStore, getAppointStore, removeAppointStore, removeAllStore } from '@pangjiaming/local_storage'

  3. 调用方法

// 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()

使用方式二

  1. script标签引入/dist/localstorage.js文件

  2. 使用全局变量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

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago