ရိုးရိုးလေး ရှင်းပြမယ်
Vue component တစ်ခုတွင် <script setup>, <template> နှင့် optional <style scoped> ပါနိုင်သည်။ Component ကို feature သို့မဟုတ် responsibility တစ်ခုစီအလိုက်သေးငယ်စွာခွဲပါ။ <script setup> တွင် import လုပ်ထားသော component ကို template မှ တိုက်ရိုက်သုံးနိုင်သည်။
vue
<!-- CounterButton.vue -->
<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>
<template>
<button @click="count++">Clicked {{ count }} times</button>
</template>
<style scoped>
button { padding: .75rem 1rem; }
</style>You should see
Clicked 0 timesလက်တွေ့စမ်းကြည့်ရန်
AvatarCard.vue component တစ်ခုဖန်တီးပြီး App.vue ထဲတွင် သုံးကြိမ်ပြန်လည်အသုံးပြုပါ။
Components Basics — Vue.js