$slots


Misol

Ota komponent "topSlot" uchun kontent berganini tekshirish uchun $slots obyektidan foydalanish.

mounted(){
  if(this.$slots.topSlot){
    this.slotsText = "Content for the 'topSlot' slot is provided by the parent."
  }
  else {
    this.slotsText = "Content for the 'topSlot' slot is NOT provided by the parent."
  }
}
Misolni ishga tushirish »

ULASHISH

Ta’rif va qo‘llanilishi

$slots obyekti ota komponentdan uzatilgan slotlarni ifodalaydi.

Ota komponentdan uzatilgan slotlarni this.$slots orqali, "topSlot" nomli muayyan slotni esa this.$slots.topSlot orqali ko‘rish mumkin.

$slots obyektidan yuqoridagi misoldagidek slotlar ota komponent tomonidan berilganini tekshirish yoki render funksiyalarini yozish uchun foydalanish mumkin.


Tegishli sahifalar

Vue darsligi: Vue slotlar

Vue darsligi: Scoped slotlar

Vue darsligi: Vue v-slot

Vue ma’lumotnomasi: Vue v-slot direktivasi



W3Schools Pathfinder

Yutuqlaringizni kuzating – bu bepul!