Bootstrap

uniapp中使用pinia,并做数据持久化

  1. 安装依赖
pnpm i pinia pinia-plugin-persistedstate @nuxt/devalue -S
  1. 创建store文件夹,创建持久化插件/store/plugins.ts
import {
    App } from 'vue'
import {
    createPinia } from 'pinia'
import devalue from '@nuxt/devalue'
import {
    createPersistedState } from 'pinia-plugin-persistedstate'

export const pinia = createPinia()

export const painaInstall = (app: App) => {
   
  pinia.use
;