javascript - There is a button in the vue subcomponent. Clicking it will change the state. This state is obtained by the parent component through the interface, which means that the state of the interface needs to be changed dynamically.
三叔
三叔 2017-07-05 11:03:53
0
2
1018

A component (parent component) obtains a batch of data through the interface. The parent component props are passed to the child component (B)
After the child component renders this batch of data, there is a button that needs to be clicked to change the current state, such as from "Add to Shopping Cart" to "Add to Shopping Cart". I don’t know how to handle it so that it can dynamically change the state while clicking?
Is the event customized through sub-component?
Don’t know how to write?

三叔
三叔

reply all(2)
滿天的星座

What is the status controlled by?
If your sub-component controls data state changes
Of course it is done through the sub-component custom event
It mainly depends on how you layout it

为情所困

It is recommended to use vuex to manage status https://vuex.vuejs.org/

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template