消毒机前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
503 B

import { defineStore } from 'pinia'
export const useCountStore = defineStore({
id: 'count', // id必填,且需要唯一
// state
state: () => {
return {
count: 0,
}
},
// getters
getters: {
doubleCount: state => {
return state.count * 2
},
},
// actions
actions: {
// actions 同样支持异步写法
countAdd() {
// 可以通过 this 访问 state 中的内容
this.count++
},
countReduce() {
this.count--
},
},
})