Vue Framework တွင် Class Attribute ကိုအသုံးပြုခြင်း
class attribute ကိုအသုံးပြုခြင်းသည်
v-bind directive သို့မဟုတ်
၎င်း၏အတိုကောက်ပုံစံမှတစ်ဆင့်
လုပ်ဆောင်ပါသည်။
လက်တွေ့တွင် ကြည့်ကြရအောင်။
str property ထဲတွင်
Tag ၏ CSS Class များကို
ကြားခြားနေသောနေရာ (space) များဖြင့် သိမ်းထားသည်ဆိုပါစို့။
data() {
return {
str: 'active valid',
}
}
မည်သည့် Tag ထဲသို့မဆို CSS Class များကို ဤနည်းဖြင့်ထည့်ကြည့်ပါမည်။
<template>
<p :class="str">text</p>
</template>
အပိုဒ်တစ်ခုရှိသည်။ cssClasses property တစ်ခုရှိပြီး
ထဲတွင် CSS Class အချို့ရေးထားသည်။
ကျွန်ုပ်တို့၏အပိုဒ်ထဲသို့ ထို class များကို ပေါင်းထည့်ပါ။