🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

pinia-plugin-data

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pinia-plugin-data

> 数据持久化参照 `pinia-plugin-persistedstate`

npmnpm
Version
0.0.9
Version published
Maintainers
1
Created
Source

pinia 数据持久化

数据持久化参照 pinia-plugin-persistedstate

Feature

  • 自定义存储(加密)
  • 默认序列化是 JSON,可以自定义

快速开始

  • 安装
    • npm i pinia-plugin-data
  • 导入
import pinaPluginPersistence from "pinia-plugin-data";
import { createPinia } from "pinia";
import { createApp } from "vue";
const app = createApp(xxx);
const pinaAPP = createPinia();
pinaAPP.use(pinaPluginPersistence);
app.use(pinaAPP);
  • 在 store 配置
import {defineStore}                                      from "pinia";
defineStore( name, {
    persistence:true|{
        readonly key?: string;
    storage?: StorageLike;
    serializer?: Serializer;
    beforeRestore?: (context: PiniaPluginContext) => void;
    afterRestore?: (context: PiniaPluginContext) => void | boolean;
    slave?: string;
    center?: boolean;
    }

}
)

Keywords

pinia-plugin-data

FAQs

Package last updated on 09 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts