Package Exports
- storage-data-kit
- storage-data-kit/dist/main.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (storage-data-kit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
storage-data-kit 使用指南
npm
npm install storage-data-kit
Storage 存储类 ,存储在 localStorage 中
Storage 使用需要实例,
配置参数描述 key : 秘钥
存储数据
@param key
@param data
setItem( key:string,data:anyData): string
读数据
@param key,
@param proxy 默认false 是否开启代理,开启后可直接修改localStorage中的数据
getItem( plaintext:string): string
删除数据
@param key
removeItem(key:string): string
// 实例1 不加密
// 引入
import { Stroage } from "storage-data-kit";
let storage = new Storage();
// 设置数据
storage.setItem("key", { name: "mark", age: "22" });
// 开启代理
let obj = storage.getItem("key", true);
// 存储的数会自动更新
obj.name = "jack";
// 实例2.1 自定义加密 加密
let storage2 = new Storage({encrypt:true,key:'秘钥'});
// 设置数据
storage2.setItem("key", { name: "mark", age: "22" });
// 开启代理
let obj2 = storage2.getItem("key", true);
// 存储的数会自动更新
obj2.name = "jack";
// 实例2.2 默认加密
import { storageEncryptData } from "storage-data-kit";
// 设置数据
storageEncryptData.setItem("key", { name: "mark", age: "22" });
// 开启代理
let obj2 = storageEncryptData.getItem("key", true);
// 存储的数会自动更新
obj2.name = "jack";