ref() 타입제한 없이 사용가능하나 일반적으로 string, number, boolean 과 같은 원시타입에 사용
reactive() 객체 타입만 사용
인라인 핸들러
<button @click="cnt++"></button>
<button @mouseenter="addCnt(2)">
const addCnt = ref(0);
function click(num){
addCnt.value = +=num;
}
<template>
<h1 v-show="flg">v-show 입니다.</h1>
<button @click="flg = !flg">토글</button>
</template>
<script setup>
import {ref} from 'vue';
const flg = ref(true);
</script>
<template>
<h1 v-if="flg === '0'">0 입니다.</h1>
<h1 v-else-if="flg === '1'">1 입니다.</h1>
<h1 v-else>기타 입니다.</h1>
<input v-model="flg" type="text" name="flg" id="flg">
</template>
<script setup>
import {ref} from 'vue';
const flg = ref('0');
</script>
vue의 반복문으로 v-for 디렉티브를 사용하여 배열을 리스트로 렌더링
v-for=”값 in 데이터” 또는 v-for=”(값, 키) in 데이터” 로 정의하여 사용
단순 n 회의 반복