点击id为inner元素后,控制台打印是?
<template>
<div>
<div @click="clickMe">
<div @click="clickMe" id="inner">点我</div>
</div>
</div>
</template>
<script>
export default {
name: "test",
methods:{
clickMe(){
console.log('start')
setTimeout(()=>{console.log('setTimeout1')},0)
this.$nextTick(()=>{
console.log('nextTick1')
this.$nextTick(()=>{console.log('nextTick2')})
setTimeout(()=>{console.log('setTimeout2')},0)
})
console.log('end')
}
}
}
</script>
微任务、宏任务
start end nextTick nextTick2
start end nextTick nextTick2
setTimeout setTimeout