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

Multiple named views in single vue file #2633

Closed
joshua-s opened this Issue Mar 1, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@joshua-s
Copy link

joshua-s commented Mar 1, 2019

What problem does this feature solve?

It would be great if I could specify multiple named views in a single .vue file. This would make it easier and more centralized to manage applications that require multiple views for each route. By having all the code in one file, it would also make it easy to update both components simultaneously.

What does the proposed API look like?

For instance, if I had header and content views:

<!-- Named slot -->
<template slot="header">
  <div>
    Header content
  </div>
</template>

<!-- Default slot -->
<template>
  <div>
    Body content
  </div>
</template>
@posva

This comment has been minimized.

Copy link
Member

posva commented Mar 2, 2019

Thanks for the proposal. Unfortunately, I think this goes against Vue rule of having one file per component and it brings a problem when creating the script and style counterpart as the user would be required to specify a name (you called that slot) too

This is however something you could achieve with a custom webpack loader

@posva posva closed this Mar 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.