Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Vue multiple slot

# Parent Component
<template>
  <div class="the-card">
    <div class="the-card_title">
      {{ cardTitle }}
    </div>
   <div class="the-card_body">|
     <slot>
        Default card content goes here
      </slot>
    </div>
    <div class="the-card_footer">
      <slot name="footer">
        Default footer
      </slot>
    </div>
  </div>
</template>


# Card Component
<template>
  <header>
    <h2>{{ msg }}</h2>
  </header>
  <div>
    <the-card cardTitle="About Me">
      <template v-slot:default>/* or you can use #default*/
         <p>Hi,Iam Mamunur Rashid Rimon, blah blah
      </template>
      <template v-slot:footer>/* or you can use #footer*/
        <a href="https://rimonbd.com">Learn More</a>
      </template>
    </the-card>
    <the-card cardTitle="Apple iPhone 12 Pro">
      <template v-slot:default>
        <img
          src="https://fdn2.gsmarena.com/vv/bigpic/a
          alt=""
        />
        p>
          Versions: A2407 (International); A2341 (US
          A2408 (China, Hong Kong)
        </p>
      </template>
      <template v-slot:footer>
        <button>Buy Now</button>
        <button>Add to Cart</button>
      </template>
    </the-card>
</the-card>
</div>
</template>
Comment

PREVIOUS NEXT
Code Example
Javascript :: react datepicker documentation 
Javascript :: write !important in react 
Javascript :: nodemailer 
Javascript :: nested function 
Javascript :: location maps react native 
Javascript :: javascript ternary operator syntax 
Javascript :: useeffect componentdidmount 
Javascript :: js get type 
Javascript :: javascript promise state 
Javascript :: add options to select box dynamically jquery 
Javascript :: (node:15855) UnhandledPromiseRejectionWarning: MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017 
Javascript :: what is event loop in javascript 
Javascript :: combine csv files javascript 
Javascript :: named parameters 
Javascript :: make a component update every second react 
Javascript :: string to code javascript 
Javascript :: object to string js 
Javascript :: javascript link detector 
Javascript :: calling javascript from java 
Javascript :: array iterator javascript 
Javascript :: link in next js is refresh page 
Javascript :: The Lodash Array Remove Method 
Javascript :: mongoose virtual populate 
Javascript :: express example 
Javascript :: replace spaces with dashes 
Javascript :: javascript date range 
Javascript :: how to make a bigint in javascript 
Javascript :: call function 
Javascript :: Set Default Parameter Value 
Javascript :: node js ocr 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =