If the calculation property of VUE2.0 cannot be passed, how can my requirements be realized?

demand:

vuex.state

idea:
my initial idea is to get the list of shopping carts in state when I first enter the page, and when I cycle the product, send product information to the computing attribute to determine whether it has been purchased in the shopping cart. When you click Buy, you can dynamically change the value of the calculated property by changing only the number of shopping carts.

I would like to ask you, is there a better solution? I have learned to use component implementation to pass product information to the component when looping, and to use computational properties within the component. But is there any good way if you don"t use components?

Mar.15,2021

doesn't vuex write a mutation that modifies the number of purchases in this shopping cart list? Submit this mutation solution directly.
your merchandise list page dynamically changes by calculating the value returned by the property. There's nothing wrong with it.

Menu