vuejs-challenges icon indicating copy to clipboard operation
vuejs-challenges copied to clipboard

11 - 下一次DOM更新

Open kangxiangli opened this issue 2 years ago • 0 comments

<script setup>
import { ref, nextTick  } from "vue"

const count = ref(0)

function increment() {
  count.value++

 
 nextTick(() => {
   // 访问更新后的 DOM
   console.log(+document.getElementById("counter").textContent === 1)
 })
}
</script>

<template>
  <button id="counter" @click="increment">
    {{ count }}
  </button>
</template>


kangxiangli avatar Sep 01 '22 08:09 kangxiangli