props
, data
, methods
, computed
, mounted
ใใๅคๆใใฆใในใ<!-- ใใณใใฌใผใไพ: 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>
๐ ใใใใณใใผใใฆไฝฟใใฐ้ใใ
"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 ใใณใใฌใผใ"
}