Hi FE !
Ai
git
前端面试题
前端小tip
  • vite
  • webpack
npm
  • vue2
  • vue3
react
GitHub
Ai
git
前端面试题
前端小tip
  • vite
  • webpack
npm
  • vue2
  • vue3
react
GitHub
  • V003-mapActions如何传参

V003-mapActions如何传参

mapActions如何传参

调用页面

methods:{
  ...mapActions([
        'programPop'
    ]),
    doSomething() {
      this.programPop(true)
    }
}

vuex中

actions.js

// 展示节目单(...mapAction 传参写方法, str即为传入的参数)
  programPop:({
      commit
  },str) => {
      commit(types.PROGRAMPOP,str)
  },



mutations.js

//展示节目列表
    [PROGRAMPOP](state,str) {
        console.log(123,state,str)
        state.programPopShow = str
    },

其他均无变化,参照V001即可

Edit this page
最近更新: 2025/6/27 02:24
Contributors: qdleader
qdleader
本站总访问量 129823次 | 本站访客数 12人