vue-h-ls

1.0.1 • Public • Published

h-ls 本地永久存储,可设置过期时间

  1. 前端js使用localStorage的时候只能存字符串,不能存储对象

h-ls 可以存储 object undefined number string

  1. localStorage没有过期时间

h-ls 可以设置以天为单位的过期时间

安装

yarn add h-ls || npm i h-ls

使用

import LS from 'h-ls'

Vue.use(LS, { name: 'ls' })

let value = {name: 'xiejun'} // 设值 // set (key, value, expiredTime) // expiredTime 过期时间单位是天 1/8 === 3小时 this.$ls.set('key', value, 1)

// 获取值 this.$ls.get('key')

// 清楚所有缓存 this.$ls.clear()

// 删除某个key this.$ls.remove(key)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    8
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    8
  • 1.0.0
    0

Package Sidebar

Install

npm i vue-h-ls

Homepage

/

Weekly Downloads

8

Version

1.0.1

License

MIT

Unpacked Size

16.6 kB

Total Files

9

Last publish

Collaborators

  • haohao.love