@abarchibody/cookie 中文文档教程
cookie用于读取、写入localstorage。
安装
$ npm i @abarchibody/cookie
用法
const data = [1, 2, 3, 4]
import cookie from '@abarchibody/cookie'
Write to localstorage
cookie.set('data', data);
Read to localstorage
const myData = cookie.get('data')
console.log(myData)
// [1, 2, 3, 4]
Delete data to localstorage
cookie.remove('data');
cookie is used to read, write to the localstorage.
to install
$ npm i @abarchibody/cookie
Usage
const data = [1, 2, 3, 4]
import cookie from '@abarchibody/cookie'
Write to localstorage
cookie.set('data', data);
Read to localstorage
const myData = cookie.get('data')
console.log(myData)
// [1, 2, 3, 4]
Delete data to localstorage
cookie.remove('data');