console
var vm = new Vue({
el: "#tick",
data: {
msg: 123
},
methods: {
updateMsg() {
this.msg = 456;
console.log("first_this.msg",this.msg)
console.log("first_this.$refs.msg.textContent", this.$refs.msg.textContent)
this.$nextTick(() => {
console.log("first_nextTick", this.$refs.msg.textContent)
})
for (let i=0; i < 5000; i++) {
console.log('i')
}
this.msg = 789;
console.log("second_this.msg",this.msg)
console.log("second_this.$refs.msg.textContent", this.$refs.msg.textContent)
this.$nextTick(() => {
console.log("second_nextTick", this.$refs.msg.textContent)
})
}
}
})
<div id="tick">
<p ref="msg">{{ msg }}</p>
<button @click="updateMsg">更新msg</button>
</div>