sls-store
v1.0.6
Published
First upload. This component is not encrypted for development, but encrypted for production. Blog post:https://www.cnblogs.com/ooo51o/p/15262827.html
Downloads
3
Readme
sls-store
sls-store是一个存储本地的方法。操作简单,易上手。
配置如下面配置好后即可使用。
源码
使用方法也在博客里。
配置
| 字段 | 类型 | 介绍 | | ---- | ---- | ---- | | NAME | String | 全存放的key | | LOCK | Boolean | 是否加密,默认不加密 | | STORE_WHO | String | 本地存储 填‘sessionStorage’,‘localStorage’ 默认‘sessionStorage’ |
main.js
文件
import {setting} from "sls-store";
setting.NAME = "vue";
setting.LOCK = process.env.NODE_ENV != 'development';
setting.STORE_WHO = "sessionStorage";
用法
import {appStore} from "sls-store";
// 存入
appStore.name = '我是二刺螈'
// 查看
console.log(appStore.name)
// 修改
appStore.name = '我真的是二刺螈'
React Vue2/3
都可以用