webfansplz / vuejs-challenges

Collection of Vue.js challenges
https://vuejs-challenges.netlify.app/
MIT License
2.7k stars 188 forks source link

12 - 优化性能的指令 #2685

Open whitevenus opened 4 months ago

whitevenus commented 4 months ago
<script setup>
import { ref } from 'vue';

const count = ref(0);

setInterval(() => {
  count.value++;
}, 1000);
</script>

<template>
  <span v-once>Make it never change: {{ count }}</span>
</template>