API 文档 / pinia / MutationType

Enumeration: MutationType

pinia.MutationType

SubscriptionCallback 的可能类型

Enumeration members

direct

direct = "direct"

Direct mutation of the state:

  • store.name = 'new name'
  • store.$state.name = 'new name'
  • store.list.push('new item')

定义于

pinia/src/types.ts:50


patchFunction

patchFunction = "patch function"

$patch 和一个函数更改了 state:

  • store.$patch(state => state.name = 'newName')

定义于

pinia/src/types.ts:64


patchObject

patchObject = "patch object"

$patch 和一个函数更改了 state:

  • store.$patch({ name: 'newName' })

定义于

pinia/src/types.ts:57