gpt4 book ai didi

vue.js - 从另一个 Action 中调用一个 Action

转载 作者:搜寻专家 更新时间:2023-10-30 22:07:16 25 4
gpt4 key购买 nike

我的操作设置如下:

get1: ({commit}) => {
//things
this.get2(); //this is my question!
},
get2: ({commit}) => {
//things
},

我希望能够从另一个 Action 中调用一个 Action ,因此在本例中我希望能够从 get1() 中调用 get2()。这可能吗?如果可以,我该怎么做?

最佳答案

您可以访问第一个参数传递的对象中的dispatch方法:

get1: ({ commit, dispatch }) => {
dispatch('get2');
},

这包含在 documentation 中.

关于vue.js - 从另一个 Action 中调用一个 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45848974/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com