Subscribe on changes!

$nextTick don't work as expected

avatar
Sep 30th 2020

Version

3.0.0

Reproduction link

https://jsfiddle.net/shaan1974/rokqebcL/

Steps to reproduce

Just click on the Button "Change LG" and take a look into the console. "This" var ( line #17) inside the nextTick is the window object and not the current instance.

What is expected?

"This" should be the current instance

What is actually happening?

"This" is the Window object


To see how it's work with Vue 2 and 3 i'v created two fiddle.

Vuejs 2 ex => https://jsfiddle.net/shaan1974/qf4umgh2/ Vuejs 3 ex => https://jsfiddle.net/shaan1974/rokqebcL/

avatar
Sep 30th 2020

I'm surprised it works on Vue 2. You should use an arrow function to keep the context or even use the promise syntax. I thought the callback syntax wouldn't be supported anymore

avatar
Sep 30th 2020

We should keep it compatible though, seems like an easy fix.

avatar
Sep 30th 2020

Thanks guys with arrow function it's working ;)