๐Ÿš€ 9-1. ๆ›ธใๆ›ใˆไฝœๆฅญใ‚’ๅŠน็އๅŒ–ใ™ใ‚‹ๅฐๆŠ€

โœ… ่ฆ็‚นใพใจใ‚


๐ŸŸข ๅฐๆŠ€โ‘ : ใพใšๅฐใ•ใชใƒ•ใ‚กใ‚คใƒซใ‹ใ‚‰ๅค‰ๆ›ใ™ใ‚‹


๐ŸŸก ๅฐๆŠ€โ‘ก: ๅค‰ๆ›ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใ‚’ไฝœใฃใฆใŠใ

<!-- ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆไพ‹: setupๅŸบๆœฌๅฝข -->
<script setup lang="ts">
const props = defineProps<{ step?: number }>();
const count = ref(0);
const doubleCount = computed(() => count.value * 2);
const increment = () => { count.value += props.step ?? 1; };
onMounted(() => { console.log('mounted!'); });
</script>

๐Ÿ”– ใ“ใ‚Œใ‚’ใ‚ณใƒ”ใƒผใ—ใฆไฝฟใˆใฐ้€Ÿใ„ใ€‚


๐ŸŸฃ ๅฐๆŠ€โ‘ข: VSCode ใฎใ‚นใƒ‹ใƒšใƒƒใƒˆใ‚’ๆดป็”จใ™ใ‚‹

"vue3 setup template": {
  "prefix": "vue3setup",
  "body": [
    "<script setup lang=\\"ts\\">",
    "const props = defineProps<${1:Props}>();",
    "const emit = defineEmits<${2:Emits}>();",
    "const count = ref(0);",
    "onMounted(() => {",
    "  console.log('mounted!');",
    "});",
    "</script>"
  ],
  "description": "Vue 3 Composition API setup ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆ"
}