vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.97k stars 33.68k forks source link

v-if not patching component scoped slot correctly #12223

Open decademoon opened 3 years ago

decademoon commented 3 years ago

Version

2.6.14

Reproduction link

https://jsfiddle.net/5w1ydeu8/3/

Steps to reproduce

What is expected?

The scoped slot should update.

What is actually happening?

The scoped slot doesn't update.

JuniorTour commented 3 years ago

Use v-if as a workaround:

  <Foo v-if="frame === 'a'">
    <template #default="x">
      a
    </template>
  </Foo>
  <Foo v-if="frame === 'b'">
    <template #default="x">
      b
    </template>
  </Foo>
  <Foo v-if="frame === 'c'">
    <template #default="x">
      c
    </template>
  </Foo>

But it does have something wrong with v-else-if, I'm looking into it.

decademoon commented 3 years ago

@JuniorTour Thanks, I'm aware of various workarounds (like using key), but I thought this behavior was odd.