slider icon indicating copy to clipboard operation
slider copied to clipboard

Prevent method from a 2nd slider to be called

Open heyjudemaldicas opened this issue 2 years ago • 1 comments

I have 2 sliders linked by certain calculations. The 2nd slider's v-model downpayment.value is being updated whenever the 1st slider is dragged selectPrice(). This triggers the update for method selectDownpayment(), which should not be the case. Is there anything that I can do to not trigger it?

https://codesandbox.io/s/focused-andras-u9xv20

heyjudemaldicas avatar Apr 05 '22 10:04 heyjudemaldicas

I just realized I posted a wrong assumption here after debugging again (yup, my bad).

Using below image as an example, an initial price 45000 gives me a downpayment value of 14445. Updating the price from 45000 to 44500 should give me a downpayment value of 14285. But checking the logs, it returned the old value which is 14445.

drag

I realized that updating downpayment.value in my selectPrice method is "NOT REALLY" updating the slider value. And when it moves to selectDownpayment, the old value of downpayment.value is the one being returned.

So my question is, is there a way to force update downpayment.value immediately?

heyjudemaldicas avatar Apr 05 '22 14:04 heyjudemaldicas

Feel free to reopen if this is still a question, but please create an example I can edit and I'll be happy to help. Closing this for now.

adamberecz avatar Dec 20 '22 11:12 adamberecz