Created
June 24, 2025 07:21
-
-
Save Kcko/1364cfb83a61603c33bd43595a517eb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://learnvue.co/articles/v-once-v-memo | |
<script setup> | |
import { ref } from 'vue' | |
const subscribers = ref(4000) | |
const views = ref(10000) | |
const likes = ref(3000) | |
</script> | |
<template> | |
<div> | |
<div v-memo="[subscribers]"> | |
<p>Subscribers: {{ subscribers }}</p> | |
<p>Views: {{ views }}</p> | |
<p>Likes: {{ likes }}</p> | |
</div> | |
<button @click="subscribers++">Subscribers++</button> | |
<button @click="views++">Views++</button> | |
<button @click="likes++">Likes++</button> | |
<div> | |
<p>Current state:</p> | |
<p>Subscribers: {{ subscribers }}</p> | |
<p>Views: {{ views }}</p> | |
<p>Likes: {{ likes }}</p> | |
</div> | |
</div> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment