Hahaha, when I was on QQ yesterday, I accidentally found that someone read my blog and added me, which caused a small wave in my heart.
The company is doing e-commerce recently, and the front-end framework used is still VUE
Moment MAX (WeChat official account) can be searched, it seems that Apple's AppStore can also be searched, but it should be an internal beta version
Come back to the Chinese body, tell me about the coupon collection center we did today
It's a bit similar to Jingdong's coupon collection center. Just finished the test, and all the coupons were collected by me.
The effect is to click to receive it immediately, the text will be used immediately, and the popup will be successfully received.
However, because the interface is not real-time, I did not use the interface data to judge and let the user click to receive the coupon while changing the state.
However, Grandpa Mao said: There are always more ways than difficulties~
In order to satisfy the visual effect, I played a little clever~~~
This is the interface I go to when I click to receive, hahaha, Xiaoqing is that I changed the status of the coupon before going through the interface,
Of course, if the interface fails, it will not affect other places. When the page is refreshed, the coupon will be restored to the state to be claimed.
In fact, I put the part of changing the state in the interface request before, but because this in vue points to the current execution object, and put it in the request, this will execute the interface, not the coupon I clicked, to achieve Can't switch coupons
event.currentTarget is used to get the currently clicked DOM
In vue, when it is inconvenient to use ref to change, we can modify the attribute style of the element through native js
Well, let's talk nonsense
i'm a rookie
If you think my writing is rubbish, please criticize and correct me