“se transformer” Réponses codées

se transformer

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

  <template v-slot:other="otherSlotProps">
    ...
  </template>
</current-user>
Strange Sandpiper

se transformer

<base-layout>
  <template slot="header">
    <h1>Here might be a page title</h1>
  </template>

  <p>A paragraph for the main content.</p>
  <p>And another one.</p>

  <template slot="footer">
    <p>Here's some contact info</p>
  </template>
</base-layout>
Strange Sandpiper

se transformer

<div class="container">
  <header>
    <h1>Here might be a page title</h1>
  </header>
  <main>
    <p>A paragraph for the main content.</p>
    <p>And another one.</p>
  </main>
  <footer>
    <p>Here's some contact info</p>
  </footer>
</div>
Strange Sandpiper

se transformer

<span>
  <slot>{{ user.lastName }}</slot>
</span>
Strange Sandpiper

se transformer

<current-user>
  <template v-slot:default="slotProps">
    {{ slotProps.user.firstName }}
  </template>
</current-user>
Strange Sandpiper

se transformer

<!-- INVALID, will result in warning -->
<current-user v-slot="slotProps">
  {{ slotProps.user.firstName }}
  <template v-slot:other="otherSlotProps">
    slotProps is NOT available here
  </template>
</current-user>
Strange Sandpiper

se transformer

<base-layout>
  <h1 slot="header">Here might be a page title</h1>

  <p>A paragraph for the main content.</p>
  <p>And another one.</p>

  <p slot="footer">Here's some contact info</p>
</base-layout>
Strange Sandpiper

se transformer

<current-user>
  {{ user.firstName }}
</current-user>
Strange Sandpiper

se transformer

<span>
  <slot v-bind:user="user">
    {{ user.lastName }}
  </slot>
</span>
Strange Sandpiper

se transformer

<current-user v-slot:default="slotProps">
  {{ slotProps.user.firstName }}
</current-user>
Strange Sandpiper

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code