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

component's compiled code from 2.6 not compatible with Vue 2.5.* when include scopedSlot #9545

Comments

@tweet
Copy link

tweet commented Feb 21, 2019

Version

2.5.22

Reproduction link

https://jsfiddle.net/tweet/arjw5sg8/15/

Steps to reproduce

There is a vue component which written used scopedSlot feature, if I compile the source using vue's version larger than 2.6.2, the output content cannot run in 2.5.* environment.

i.e. a vue templete demo like this

  <div>
    <card slot-scope="{item}" :keyType="keyType">
      <div>test slot1</div>
      <div v-if="item.keyType=='real'">
        <slot :item="item"></slot>
      </div>
    </card>
  </div>

if it compiled from vue 2.6.6, then it cannot be work properly in vue 2.5.*

What is expected?

The output code should work in both vue 2.6 and 2.5 env

What is actually happening?

Only Vue 2.6 env works, vue 2.5 env broken.


Vue 2.6 change the 'resolveScopedSlots' function's parameter, you can see the following differance.

// 2.5.*
function resolveScopedSlots (
  fns, // see flow/vnode
  res
) {
...

// 2.6.*
function resolveScopedSlots (
  fns, // see flow/vnode
  hasDynamicKeys,
  res
) {
...

After the issue #9438 resolved, this problem occured.

@posva
Copy link
Member

posva commented Feb 21, 2019

This can be annoying but at the same time you only need to update Vue, there are no breaking changes.apparently we can make it work again although lib authors will have to recompile and publish their libs once the fix is released. Sorry for the inconvenience :(

@tweet
Copy link
Author

tweet commented Feb 21, 2019

@posva If this component published to npm, and other people use it, we cannot tell all the users to update Vue, you know.

@posva
Copy link
Member

posva commented Feb 21, 2019

I'm not asking you to tell them, we can try to make them aware but that's pretty much the only solution right now. That or sticking with a previous version of your lib alongside the previous version of Vue, but it makes more sense to upgrade both

Lostlover pushed a commit to Lostlover/vue that referenced this issue Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment