1.0.0 • Published 6 years ago

short-local-storage v1.0.0

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

storage

localStorage api 封装

安装

npm 安装

npm install short-local-storage

script 引入

<script src='./storage.js'></script>

用法

模块化写法

import storage from 'short-local-storage'

// localStorage
storage.set(key,val)
storage.get(key)
storage.remove(key)
storage.clear()

script 引入则直接调用 api

API

set(key, val) 通过 key 和 val 设置 storage

get(key) 通过 key 获取 storage 中对应的 val

remove(key) 删除 storage 中 对应 key 的 val

clear() 清空 storages