楊村長pinia源碼剖析+手寫
import { defineStore } from 'pinia'export const useCounterStore = defineStore('counter', {
?state: () => {
? ?return { count: 0 }
?},
?// could also be defined as
?// state: () => ({ count: 0 })
?getters: {
? ?double: (state) => state.count * 2,
?},
?actions: {
? ?increment() {
? ? ?this.count++
? ?},
?},})
標(biāo)簽: