修改
77字小于1分钟
2023-07-02
修改 Store
有多种方法修改
单个更新
function changeCount(number: number) {
mainStroe.count += number
}
批量更新
function changeCount(number: number) {
mainStroe.$patch({
count: count.value + number
})
}
批量更新(函数式)
function changeCount(number: number) {
mainStroe.$patch(state => {
state.count += number
state.arr.push(123)
})
}