I read a lot of tutorials and said that process.nextTick was the first to be executed, but I was the last to run it myself.
vue"s nextTick is supposed to give priority to promise, but I also execute it after comparison when I run.
what kind of task should the execution of watch belong to, Object.observe?
export default {
data() {
return {
a = false
}
}
watch: {
a() {
console.log("watch")
}
}
methods: {
myprint() {
this.a = true
setTimeout(() => console.log("settimeout"), 0)
this.$nextTick(() => console.log("vue nexttick"))
process.nextTick(() => console.log("process.nexttick"))
Promise.resolve().then(() => console.log("promise"))
console.log("start")
}
}
print out the result as:
start
promise
watch
vue nexttick
settimeout
process.nexttick