Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

named slot vue

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

<!--usage-->

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

vue.js slots

Parent Component :
<template>
  <Child>
    <template v-slot:header>
      <h1>Header </h1>
    </template>

    <template v-slot:content>
      <h1> Content </h1>
    </template>

    <template v-slot:footer>
      <h1>Footer</h1>
    </template>
  </Child>
</template>

Child component :

<template>
  <slot name="header">Default Value</slot>
  <slot name="content">Default Value</slot>
  <slot name="footer">Default Value</slot>
</template>
Comment

slot vuetify js

<button type="submit">
  <slot>Envoyer</slot>
</button>
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

what is slot in vue.js

// app.vue
<template>
  <current-user>
    <template v-slot:default="slotProps">{{ slotProps.user.firstName }}</template>    
  </current-user>
</template>
Comment

PREVIOUS NEXT
Code Example
Javascript :: timer javascript 
Javascript :: loadsh debounce 
Javascript :: open source code 
Javascript :: new keyword in js 
Javascript :: scribbletune 
Javascript :: javascript reverse array and separate by spaces 
Javascript :: what the cjs.js fiel use 
Javascript :: Activez la compression de texte react js 
Javascript :: GTM Qgiv 
Javascript :: calculate init code hash nodejs 
Javascript :: node.js server-side javascript 
Javascript :: datetimepicker 
Javascript :: dart get vfirst key value of map 
Javascript :: simple if condition for form validation 
Javascript :: flask server js return from folder 
Javascript :: vs 2019 how to publish angular environment prod 
Javascript :: object for loop 
Javascript :: theme ui currentcolor 
Javascript :: useMatch 
Javascript :: eeeeee 
Javascript :: feathersjs mysql example 
Javascript :: ggufhca spingnift cpwjirbgi bshhv 3 bvvvslit nevkdhaer nhdydg kllojb n 
Javascript :: mongodb install err npm 
Javascript :: wow uh dk makros 9.01 
Javascript :: vuex store example medium 
Javascript :: [ERROR -]<ng-select {{items}}="cities" 
Javascript :: parallel testing vs cross browser testing 
Javascript :: react steam auth 
Javascript :: No provider for HTTP! { HTTP Native} 
Javascript :: validator.addmethod username duplicates 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =