在没使用扩展办法的时候,在组件当中通过下面方式进行传参

testMethods(data) {
    this.$store.commit("add",data)
}

而使用了扩展函数了之后,直接在调用的地方传入参数,会自动传递的

...mapMutations({
      testMethods: "add",
})

这里在我调用  @click(testMethods(data))   这个时候传入  data  扩展写法会自动将这个参数传递过来

 

...mapMutations([
      'testMethods'
])

数组写法

相关文章:

  • 2022-12-23
  • 2021-06-01
  • 2021-08-12
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2021-12-01
猜你喜欢
  • 2022-01-19
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
相关资源
相似解决方案