Pinia
安装
npm install pinia
创建 Store
在 src/store 中创建 index.ts,并导出 store
src/store/index.tstypescript
import { createPinia } from 'pinia'
const store = createPinia()
export default store
在 main.ts 中引入并使用
main.tstypescript
import { createApp } from 'vue'
import App from './App.vue'
import store from './store'
const app = createApp(App)
app.use(store)