Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slots render issure #10728

Open
l-x-f opened this issue Apr 18, 2024 · 2 comments
Open

Slots render issure #10728

l-x-f opened this issue Apr 18, 2024 · 2 comments

Comments

@l-x-f
Copy link

l-x-f commented Apr 18, 2024

Vue version

3.4.23

Link to minimal reproduction

https://github.com/l-x-f/vue-slots-render-issure

Steps to reproduce

components/Children0.vue

<template>
  <div>
    <slot name="default">
      <component v-if="$slots.default" :is="$slots.default" />
      <template v-else> default-value</template>
    </slot>
  </div>
</template>

components/Children1.vue

<template>
  <div>
    <slot name="default"> default-value</slot>
  </div>
</template>

App.vue

<template>
  <h3>examples1</h3>
  <Children0>
    <template v-if="false">100</template>
  </Children0>
  <br />

  <h3>examples2</h3>
  <Children0>
    <template v-if="false" #default>100</template>
  </Children0>
  <br />

  <h3>examples3</h3>
  <Children1>
    <template v-if="false">100</template>
  </Children1>
</template>

<script setup>
import Children0 from './components/Children0.vue'
import Children1 from './components/Children1.vue'
</script>

What is expected?

I expected Examples1 to render 'default-value', but there was no rendering.

What is actually happening?

I expected Examples1 to render 'default-value', but there was no rendering.

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
    Memory: 3.98 GB / 15.75 GB
  Binaries:
    Node: 16.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.15.0 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (123.0.2420.97)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    vue: ^3.4.23 => 3.4.23

Any additional comments?

No response

@Doctor-wu
Copy link
Contributor

reproduce in playground

@edison1105
Copy link
Member

edison1105 commented Apr 18, 2024

The fix may be a breaking change.

  • If after the fix the effect of examples1 is consistent with examples2, it may cause the slot fallback content that should not be displayed on the user side to be displayed.
  • If after the fix the effect of examples2 is consistent with examples1, it may cause the slot fallback content that should be displayed on the user side to not be displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants