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

Missing content passed to a dynamic list of slots #9037

Closed
revolter opened this issue Nov 7, 2018 · 8 comments
Closed

Missing content passed to a dynamic list of slots #9037

revolter opened this issue Nov 7, 2018 · 8 comments

Comments

@revolter
Copy link

revolter commented Nov 7, 2018

Version

2.5.17

Reproduction link

https://jsfiddle.net/Lytuc02x/6/

Steps to reproduce

N/A

What is expected?

The #line-1 and #line-2 elements should contain the First line and respectively Second line texts.

What is actually happening?

The mentioned elements are empty.

@AngCosmin
Copy link

Do this:

<slot :name="'line-' + index"></slot>

@Justineo
Copy link
Member

Justineo commented Nov 7, 2018

As @AngCosmin said. You need to use the binding syntax here.

@Justineo Justineo closed this as completed Nov 7, 2018
@revolter
Copy link
Author

revolter commented Nov 7, 2018

But shouldn't it throw the Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. error like it does for the id attribute for example?

@Justineo
Copy link
Member

Justineo commented Nov 7, 2018

Because we used to support interpolating attributes with {{ and }} so if such syntax is detected inside an attribute, we can assume that the user might be migrating from v1 to v2. But we never supported JS expressions inside an attribute without any binding syntax so it's not gonna be warned.

@revolter
Copy link
Author

revolter commented Nov 7, 2018

You misunderstood me. In the example I linked in the first post, I had name="line-{{ index }}" instead of :name="'line-' + index".

So what I was trying to say was that vue should throw the Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. for code like <slot name="line-{{ index }}"></slot> too.

@Justineo
Copy link
Member

Justineo commented Nov 7, 2018

I see. I think this could be enhanced.

@revolter
Copy link
Author

revolter commented Nov 7, 2018

Should I open a new issue to track this change or could we re-open and use this one?

@Justineo
Copy link
Member

Justineo commented Nov 7, 2018

A new feature request would be fine. 😄

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

No branches or pull requests

4 participants
@Justineo @revolter @AngCosmin and others