How to pass in multiple parameters using action in Vuex
This article mainly introduces the relevant knowledge of "how to use action to pass in multiple parameters in Vuex". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope that this article "how to use action in Vuex to pass in multiple parameters" can help you solve the problem.
Solution:
Submit the second parameter in the release of the object, like this
Mutations = {PRODUCT_ADDTO_CART: (state,product) = > {/ / code}} actions = {productaddtocart: (context,value) = > {context.commit ('PRODUCT_ADDTO_CART', value);},}
When the page calls a method, it looks like this:
ProductAddToCart (item,productNum) {this.productaddtocart ({"item": item, "num": this.productNum})}
The key information here is to package the parameters into a dictionary object and pass them in. If you call it in mutations, then product.item,product.num will solve the problem.
This is the end of the introduction on "how to pass in multiple parameters using action in Vuex". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.