[Vuejs]-How to update a ref in a Vue app from external code?

1👍

app is application object and not root component instance, it plays the same role as Vue in Vue 2.

It should be:

const instance = app.mount('#app')
...
instance.timer = ...

Unless Vue application is third-party code that cannot be modified, it’s a good practice to move all relevant logic (setInterval, etc) inside the application and expose public methods to interact with the page.

Leave a comment