Pinia

Подключение:

1
2
3
4
5
6
7
8
9
10
import { createApp } from 'vue'import { createPinia } from 'pinia' import App from './App.vue' const app = createApp(App) app.use(createPinia()) app.mount('#app')

Создание стора:

1
2
3
4
5
6
7
8
9
10
11
12
import { defineStore } from 'pinia'import { ref } from 'vue' export const useStore = defineStore('store', () => { const value = ref([]) const fn = () => { //... } return { value, fn }})