Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Separate template to many files #223

Open
EmilMoe opened this issue Mar 13, 2018 · 2 comments
Open

Separate template to many files #223

EmilMoe opened this issue Mar 13, 2018 · 2 comments

Comments

@EmilMoe
Copy link

EmilMoe commented Mar 13, 2018

I am having a huge component now at 7-800 lines and I would very much like to split it to different files. My biggest part of the component is the template section and I would therefor like to know if it's possible to include parts from other files? I have seen that you can do a <template src="file.html"></template> but only if it's at the root level.

Is there an option when I want to do it in the middle of my template section?

@inca
Copy link

inca commented Mar 14, 2018

Fwiw I usually split heavy templates into separate components, just pass required stuff there as prop.

Oftentimes this leads to a better separation of concerns (e.g. props, computed and methods are nautrally split between sub-components and almost never shared). However, in rare cases you can also pass this as a prop to child component — this way child will have a direct access to parent.

@EmilMoe
Copy link
Author

EmilMoe commented Mar 14, 2018

Thanks, but.. I wish I could, but maybe I just don't understand some logic. It's a component with sub components so everything screws up when I separeate those subs, maybe because the sub has a callback once completed.

I tried a few things out but I didn't succeed and I think reasonable time has run out :-(

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

No branches or pull requests

2 participants