Search
 
SCRIPT & CODE EXAMPLE
 

HTML

named slot vue

<slot name="header"></slot>

<!--usage-->

<template v-slot:header>
  <h1>Here might be a page title</h1>
</template>
Comment

use of slot in vue

/*first component*/
<template>
  <header>
    <h2>{{ msg }}</h2>
  </header>
  <div>
    <the-card cardTitle="About Me">
       <p>Hi,Iam Mamunur Rashid Rimon, blah blah</p>
    </the-card>
    <the-card cardTitle="Apple iPhone 12 Pro">
      <img
        src="https://fdn2.gsmarena.com/vv/bigpic"
        alt=""
      />
      <p>
        Versions: A2407 (International); A2341 (USA)
        A2408 (China, Hong Kong)
      </p>
    </the-card>
    <the-card cardTitle="Services">I
      <ul>
       <li>Web Development</li>
      </ul>
    </the-card>
  </div>
</template>
<script>
import TheCard from "./TheCard.vue";
export default{
  data(){
    return{
      msg: "Vue3 Bangla Tutorial"
    };
  },
  components:{
    TheCard
};
</script>


/*first component*/






/*second component*/
<template>
  <div class="the-card">
    <div class="the-card_title">
     {{ cardTitle }}
    </div>
    <div class="the-card_body">
    <slot>default value if slot is empty</slot>
    </div>
  </div>
</template>
<script>
export default{
 props: ["cardTitle"]
};
</script>

/*second component*/
Comment

PREVIOUS NEXT
Code Example
Html :: copyright symbol in html 
Html :: emmet unordered list 
Html :: jackson maven 
Html :: laravel blade html content 
Html :: slider flash 
Html :: html telephone 
Html :: meta og:image 
Html :: tailwind display inline block 
Html :: html h1 not show 
Html :: magento 2 call phtml file in cms page 
Html :: html lang en-us or en-US 
Html :: my dixon earbuds are not in sync 
Html :: html checkbox checked 
Html :: form with no action 
Html :: html not showing 
Html :: javascript html reCAPTCHA 
Html :: marquee tag in html 
Html :: form multipart/form-data 
Html :: how to display an array in html 
Html :: bootstrap latest version cdn 
Html :: select empty option 
Html :: html fieldset color background 
Html :: internal link css 
Html :: Flutter Embedded Iframe 
Html :: div fit content background 
Html :: html format date 
Html :: arnav.tcode.in 
Html :: how to apply color to bootstrap icons 
Html :: navbar bootstrap 
Html :: html change background color 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =