In my opinion,the process should be: DataChange --> DOM-Rerender --> Callback function passed to $nextTick execute. right? but in the simple example below,I can't figure it out
<div id='app'>
{{msg}}
</div>
let app = new Vue({
el:'#app',
data:{
msg:'message'
},
mounted(){
this.$nextTick(()=>{
this.message = 'NEW MESSAGE'
})
}
})
Idon't know why the function execute(the message become 'NEW MESSAGE'),'cause I didn't change any data, I thought I must change data like ' this.someDataProperty = foo ' so the callback passed to $nextTick could execute?
and I read docs about vm.$nextTick,it says callback passed to the nextTick function will be executed after the next DOM update.but what is next DOM update? is it about time or browser repaint? what is next DOM update if the datachange may occur anytime?like this:
//...
mounted(){
this.msg = 'foo'
axios.get('//bar.com').then(response=>{
this.msg = response.msg
})
axios.get('//baz.com').then(response=>{
this.msg = response.msg
})
this.$nextTick(function(){
console.log(document.querySelector('#app').innerHTML)
})
}
could someone tell me when exactly the next DOM update?