Skip to content

BIMiracle/k-localstorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

k-localstorage

enhanced localStorage(加强版 localStorage)

INSTALL

npm i k-localstorage

or

pnpm i k-localstorage

USAGE

For Vue Project in main.js add

import 'k-localstorage'

create a storage.config.js

module.exports = {
	storagePrefix: '',
	localStorageWhiteList: [],
}

storagePrefix: addPrefix (在普通 key 上添加前缀)

localStorageWhiteList: localStorage.clean() will skip array (使用 localStorage.clean()时会跳过里面的值)

then you can use it as native localStorage

localStorage.a = '1'
localStorage.setItem('a', '2')
localStorage.a
localStorage.getItem('a')
localStorage.removeItem('a')
localStorage.clean() // only clean add storagePrefix and skip localStorageWhiteList (只会清除添加了storagePrefix值的前缀,会跳过localStorageWhiteList白名单里的值)

About

enhanced localStorage(加强版localStorage)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published