question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ambiguous statements about default slots

See original GitHub issue

In new slot documentation in one place it states:

Whenever there are multiple slots, use the full <template> based syntax for all slots

And in another section (Named Slots Shorthand) there is an example:

<base-layout>
  <template #header>
    <h1>Here might be a page title</h1>
  </template>

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

  <template #footer>
    <p>Here's some contact info</p>
  </template>
</base-layout>

So what is the best practice for defining default slot when there are multiple of them?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
sdrascommented, Apr 17, 2019

I’m going to try to rewrite this section with a few more details coming up with the Vue 3 release, I’ll try to fix this in that update.

1reaction
woothucommented, Mar 29, 2019

Just to clarify what I have meant: In one place docs says to wrap default slot in template tags when there are multiple slots:

Whenever there are multiple slots, use the full <template> based syntax for all

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

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

And in another places slot docs doesn’t stick to this rule:

<base-layout>
  <template #header>
    <h1>Here might be a page title</h1>
  </template>

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

  <template #footer>
    <p>Here's some contact info</p>
  </template>
</base-layout>

And yet, in another place says it is optional to stick to this rule:

However, you can still wrap default slot content in a <template> if you wish to be explicit:

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

  <template v-slot:default>
    <p>A paragraph for the main content.</p>
    <p>And another one.</p>
  </template>

  <template v-slot:footer>
    <p>Here's some contact info</p>
  </template>
</base-layout>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ambiguous statements about default slots · Issue #1995 · vuejs/v2 ...
In new slot documentation in one place it states: Whenever there are multiple slots, use the full based syntax for all slots And...
Read more >
Flexible & Ambiguous Grammars
A grammar is ambiguous if its language contains at least one string with two ... For example, if we have a table of...
Read more >
How to resolve the ambiguity of the function in qt slot
One possible solution is to use a lambda function: connect(lineEditCommandInterface, &QLineEdit::textChanged, [this](){ ReceiveCommand(); });.
Read more >
Define the Dialog to Collect and Confirm Required Information
Dialog model components · Required slots and prompts: A required slot represents information that your skill must have in order to fulfill the...
Read more >
(Ambiguity) Use Tarski's World to create a new | Chegg.com
Each of these sentences is ambiguous, so you should have two difffferent translations of each. Put the two translations of sentence 1 in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found