Skip to content

Using a builtin tree-shakable component like <transition> in a dynamic component requires manual import. #554

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

Closed
sarangnx opened this issue Sep 26, 2020 · 2 comments · Fixed by #946
Assignees
Labels
enhancement New feature or request

Comments

@sarangnx
Copy link

Version

3.0.0

Reproduction link

https://jsfiddle.net/sarangnx/t9L4fznc/23/

Steps to reproduce

When you click on the button, only first two components are having correct transitions, the third one is not behaving as expected.

What is expected?

It is expected the following two code,

  1. Using transition component directly
<transition
  enter-active-class="animate__animated animate__fadeInDown"
  leave-active-class="animate__animated animate__fadeOutUp"
>
    <div v-if="show">Transition</div>
</transition>
  1. Using transition component with Dynamic component
<component :is=" 'transition' "
  enter-active-class="animate__animated animate__fadeInDown"
  leave-active-class="animate__animated animate__fadeOutUp"
>
    <div v-if="show">Transition</div>
</component>

to work exactly same way, and render as given below in browser.

<div>Transition working</div>

What is actually happening?

The third component given in the jsFiddle (one using dynamic component) is rendered in the browser as below.

<transition
  enter-active-class="animate__animated animate__fadeInDown"
  leave-active-class="animate__animated animate__fadeOutUp"
>
    <div v-if="show">Transition</div>
</transition>

instead of just this

<div>Transition working</div>

It seems like vue has not identified the component, so just replacing it like a <div> tag.


Ultimate goal was to build a reusable transition component with slots, and switch between using <transition> and <transition-group> with the help of dynamic components <component :is="group ? 'transition-group' : 'transition' ">.

moved from vue-next isuues to docs-next vuejs/core#2238

@LinusBorg
Copy link
Member

Note to my fellows from the docs team: read the linked issue, I wrote there about how this is about tree shaking and needs documentation

@skirtles-code skirtles-code added the enhancement New feature or request label Feb 1, 2021
@skirtles-code skirtles-code self-assigned this Mar 13, 2021
@skirtles-code
Copy link
Contributor

Working on documenting this now, as well as the related problem of using the built-in components with a render function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants