Initial commit
This commit is contained in:
16
stores/counter.js
Normal file
16
stores/counter.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// stores/counter.js
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useCounterStore = defineStore('counter', {
|
||||
state: () => {
|
||||
return { count: 20 }
|
||||
},
|
||||
// could also be defined as
|
||||
// state: () => ({ count: 0 })
|
||||
actions: {
|
||||
increment (a) {
|
||||
this.count = a
|
||||
}
|
||||
},
|
||||
persist: true
|
||||
})
|
Reference in New Issue
Block a user