Answer the question
In order to leave comments, you need to log in
Weird data mutation problem, how to solve (updated with example)?
Some strange mutation is happening - https://codesandbox.io/s/n0o76nmz4
The problem is localized on line 60-62 in the HelloWorld.vue file
When scrolling down, there should be an update this.translateY
to the value ticker
Everything works correctly if I output to the console this.translateY - ticker
.
But if I do this.translateY = this.translateY - ticker
that, there is a multiple increase in the value, with each scroll, the value adds itself, and only the scroll change should change - the ticker.
What it is?
Answer the question
In order to leave comments, you need to log in
Most likely, the recursion call is due to this and the variable changes value like a snowball. Try using an explicit increment using the modulus of the difference between the current and previous event value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question