You don't destructure it, instead you use ActionContext<S, R>
, like Vuex does:(您无需对其进行解构,而是使用ActionContext<S, R>
,就像Vuex那样:)
getUserProfile( context: ActionContext<S, R>) {}
Where S
is the State
and R
is the RootState
.(其中S
是State
, R
是RootState
。)
Then you call dispatch
and commit
off of the context:(然后调用dispatch
并从上下文中commit
:)
context.dispatch('action')
context.commit('mutation')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…