How to do variable update work in riot js

Loving riot js, but why is "Hello 0" not increasing on the page in the following code example and what is the workaround at the moment?

<my-app>
    <p>Hello {myNumber}</p>
    this.myNumber = 0;
    var thisApp = this;
    setInterval(
        function(){
            thisApp.myNumber++;
        },
        1000
    );
</my-app>
+4
source share
1 answer

Inside the add function

thisApp.update();

Unable to add and configure dirty validation in riot js starting with version 2.2.2 beta.

You do not need to call update()at execution

  • external script
  • event functions executed using html riot js template expressions

... because riot js automatically calls update()after doing these actions.

+10
source

All Articles