I have done something similar, but using angularjs
It’s the same as before, but I thought of a way for the likes class, you can see if it suits you:
For example, nice is a Boolean value in the lists (returned by the server) array. If the judgment point has not been clicked, use this value to cycle through the like button class when loading for the first time
Then add an ng-click to the like button to send http. After the sending is successful, change the Boolean value of list.nice, and then change the state. To determine the position of list.nice, pass an $index to the method that encapsulates http. Alright.
The rewriting of the dom you mentioned does not actually change the value of the two-way binding. It is still traditional jquery thinking. Changing the binding value should be a more appropriate method. You can try it.
I have done something similar, but using angularjs
It’s the same as before, but I thought of a way for the likes class, you can see if it suits you:
For example, nice is a Boolean value in the lists (returned by the server) array. If the judgment point has not been clicked, use this value to cycle through the like button class when loading for the first time
Then add an ng-click to the like button to send http. After the sending is successful, change the Boolean value of list.nice, and then change the state. To determine the position of list.nice, pass an $index to the method that encapsulates http. Alright.
The rewriting of the dom you mentioned does not actually change the value of the two-way binding. It is still traditional jquery thinking. Changing the binding value should be a more appropriate method. You can try it.
You should use vue’s own methods to manage styles instead of manually changing the dom