@ithinkdt/core
Version:
iThinkDT Core
11 lines (8 loc) • 312 B
JavaScript
import { createPinia, getActivePinia } from 'pinia'
import { persistPlugin } from './persist.pinia'
export function initStore({ plugin = [], pinia, ...persist }) {
pinia ||= getActivePinia() || createPinia()
pinia.use(persistPlugin(persist))
for (const p of plugin) pinia.use(p)
return pinia
}