Open
Description
// 你的答案
<script setup>
import { ref } from "vue"
const count = ref(0)
function increment() {
count.value++
/**
* DOM还未更新,如何确保DOM已经更新 ?
* 请保证以下输出为true
*/
setTimeout(() => {
console.log(+document.getElementById("counter").textContent === 1)
}, 100)
}
</script>
<template>
<button id="counter" @click="increment">
{{ count }}
</button>
</template>