17 lines
300 B
JavaScript
17 lines
300 B
JavaScript
import { defineStore } from 'pinia';
|
|
|
|
export const useCounterStore = defineStore('counter', {
|
|
state: () => {
|
|
return {
|
|
myitem:{},
|
|
youritem:{},
|
|
};
|
|
},
|
|
// 也可以这样定义
|
|
// state: () => ({ count: 0 })
|
|
actions: {
|
|
increment() {
|
|
this.count++;
|
|
},
|
|
},
|
|
}); |