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

Same slot content for multiple template slots #9289

Closed
yamsellem opened this Issue Jan 8, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@yamsellem
Copy link

yamsellem commented Jan 8, 2019

What problem does this feature solve?

I guess, this is a new feature; Is there a way to set the same content for multiple slots without copy pasting?

So this:

<base-layout>
  <template slot="option">
    <span :class="'flag-icon-'   props.option.toLowerCase()" />{{ countriesByCode[props.option] }}
  </template>

  <template slot="singleLabel">
    <span :class="'flag-icon-'   props.option.toLowerCase()" />{{ countriesByCode[props.option] }}
  </template>
</base-layout>

What does the proposed API look like?

Could be written that way:

<base-layout>
  <template slot="['option', 'singleLabel']">
    <span :class="'flag-icon-'   props.option.toLowerCase()" />{{ countriesByCode[props.option] }}
  </template>
</base-layout>

Thanks a lot.

@Justineo

This comment has been minimized.

Copy link
Member

Justineo commented Jan 8, 2019

Now you can either

  1. define the repeated content as a component
  2. or use render functions for more flexibility
@Justineo

This comment has been minimized.

Copy link
Member

Justineo commented Jan 9, 2019

The solution you mentioned in shentao/vue-multiselect#905 (comment) is interesting. I assume this could resolve this issue. 😄

@Justineo Justineo closed this Jan 9, 2019

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