ランキングに戻る

prazdevs/pinia-plugin-persistedstate

TypeScriptprazdevs.github.io/pinia-plugin-persistedstate/

💾 Configurable persistence and rehydration of Pinia stores

piniapinia-pluginnuxtnuxt-module
スター成長
スター
2.5k
フォーク
143
週間成長
Issue
8
1k2k
2021年10月2023年5月2024年12月2026年7月
成果物npmnpm install pinia-plugin-persistedstate
README

[!IMPORTANT] This project has a new home at codeberg.org/praz/pinia-plugin-persistedstate.
Everything (issues included) has been migrated and development/maintenance will continue over there.

pinia-plugin-persistedstate

npm version bundle size license

Configurable persistence and rehydration of Pinia stores.

Read the full documentation

Features

  • Persist Pinia stores with a friendly API inspired by vuex-persistedstate.
  • Highly customizable (storage, serializer, paths picking/omitting).
  • Out of the box SSR-friendly support for Nuxt.
  • Very smol (<2kB minzipped).

Quickstart

  1. Install with your favorite package manager:

    • pnpm : pnpm add pinia-plugin-persistedstate
    • npm : npm i pinia-plugin-persistedstate
    • yarn : yarn add pinia-plugin-persistedstate
  2. Add the plugin to pinia:

import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
  1. Add the persist option to the store you want to be persisted:
import { defineStore } from 'pinia'

export const useStore = defineStore('store', {
  state: () => ({
    someState: 'hello pinia',
  }),
  persist: true,
})

Configuration

You can configure how a store is persisted by specifying options to the persist property:

export const useStore = defineStore('store', () => {
  const someState = ref('hello pinia')
  return { someState }
}, {
  persist: {
    storage: sessionStorage,
    pick: ['someState'],
  },
})

All the available configuration options are explained here.

Usage with Nuxt

Nuxt support comes out of the box thanks to the included module. You just need to install the package and add the module to your nuxt.config.ts as follows:

export default defineNuxtConfig({
  modules: [
    '@pinia/nuxt', // required
    'pinia-plugin-persistedstate/nuxt',
  ],
})

More information on storages and configuration in Nuxt here.

Limitations

There are several limitations that should be considered, more on those here.

Contributing

See the contribution guide.

License

MIT © 2021-present Sacha Bouillez

関連リポジトリ
pure-admin/vue-pure-admin

全面ESM+Vue3+Vite+Element-Plus+TypeScript编写的一款后台管理系统(兼容移动端)

VueMIT Licenseelement-plusvite
pure-admin.github.io/vue-pure-admin
20.4k3.8k
lin-xin/vue-manage-system

Vue3、Element Plus、typescript后台管理系统

VueMIT Licensevueelement-plus
lin-xin.github.io/example/vue-manage-system/
19.6k6.1k
soybeanjs/soybean-admin

A clean, elegant, beautiful and powerful admin template, based on Vue3, Vite7, TypeScript, Pinia, NaiveUI and UnoCSS. 一个清新优雅、高颜值且功能强大的后台管理模板,基于最新的前端技术栈,包括 Vue3, Vite8, TypeScript, Pinia, NaiveUI 和 UnoCSS。

TypeScriptnpmMIT Licensevue3admin-template
soybeanjs.cn
14.6k2.5k
HalseySpicy/Geeker-Admin

✨✨✨ Geeker Admin,基于 Vue3.4、TypeScript、Vite5、Pinia、Element-Plus 开源的一套后台管理框架。

VueMIT Licenseaxiostypescript
admin.spicyboy.cn
8.1k1.7k
SPlayer-Dev/SPlayer

🎵 A cross-platform music player with Jellyfin / Navidrome / Emby media server support, word-by-word lyrics, desktop & taskbar lyrics, cloud music drive, local library management, audio spectrum visualization and mobile-friendly UI. 简约的跨平台音乐播放器,支持逐字歌词、桌面歌词、任务栏歌词、云盘音乐、本地音乐管理及流媒体播放

TypeScriptnpmGNU Affero General Public License v3.0musicmusic-player
splayer.imsyy.top
7.4k1.2k
un-pany/v3-admin-vite

☀️ AI-friendly Vue3 admin template | Vue Admin | Vue Template | Vue3 Admin | Vue3 Template | Vue 后台 | Vue 模板 | Vue3 后台 | Vue3 模板

VueMIT Licenseelement-pluspinia
un-pany.github.io/v3-admin-vite/
7k1.2k
newbee-ltd/newbee-mall-vue3-app

🔥 🎉Vue3 全家桶 + Vant 搭建大型单页面商城项目,新蜂商城 Vue3.2 版本,技术栈为 Vue3.2 + Vue-Router4.x + Pinia + Vant4.x。

VueGNU General Public License v3.0vuevuejs
item.jd.com/13785266.html
6.5k1.6k
linhaojun857/aurora

基于SpringBoot+Vue开发的个人博客系统

JavaMavenApache License 2.0springbootvue
linhaojun.top
4.6k733
zclzone/vue-naive-admin

⚡️基于 Vue3 + Vite + Pinia + Unocss + Naive UI 的轻量级后台管理模板。

VueMIT Licensevue3naiveui
admin.isme.top
4k589
vuejs/vuefire

🔥 Firebase bindings for Vue.js

TypeScriptnpmMIT Licensevuefirebase
vuefire.vuejs.org
3.9k338
kailong321200875/vue-element-plus-admin

A backend management system based on vue3, typescript, element-plus, and vite

VueMIT Licensevitevuejs
element-plus-admin.cn
3.7k866
imsyy/SPlayer

🎉 一个简约的音乐播放器,支持逐字歌词,下载歌曲,展示评论区,音乐云盘及歌单管理,音乐频谱,移动端基础适配 | 网易云音乐 | A minimalist music player

VueGNU Affero General Public License v3.0musicmusic-player
3.6k670