Skip to content

docs: add example of nested named routes #1931

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

Merged
merged 4 commits into from
Jan 10, 2018
Merged

docs: add example of nested named routes #1931

merged 4 commits into from
Jan 10, 2018

Conversation

posva
Copy link
Member

@posva posva commented Dec 8, 2017

Closes #1921

</div>
```

_The nested view components are omitted here but you can find the full example at the end in the jsfiddle_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate that the jsfiddle link is at the end. Reader may ask "what jsfiddle?" here.
Maybe add the link here too?


```
/settings/emails /settings/profile
+-----------------------------------+ +------------------------------+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put some image instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this for the moment. An Image would be indeed better


## Nested Named Views

While being quite complex, it is possible to combine named views with nested view. When doing so, you will also need to name nested `router-view` components used. Let's take a Settings panel example:
Copy link
Member

@znck znck Dec 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-wording.

It is possible to create complex layouts using named views with nested views. For example, let us see following example; a settings panel.

- `UserSettings` is the view comopnent
- `UserEmailsSubscriptions`, `UserProfile`, `UserProfilePreview` are nested view components

**Note**: _Let's forget about how the HTML/CSS should look like to represent such layout and focus on the components used_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-wording.

The <template> section for UserSettings component in above layout would be something like this:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this just below

</div>
```

_The nested view components are omitted here but you can find the full example [here](https://jsfiddle.net/posva/22wgksa3/)_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-wording.

You can find the complete source code for above example here.

@posva
Copy link
Member Author

posva commented Dec 11, 2017

@znck Thanks! I updated the relevant parts the best I could

@posva posva merged commit 9e78ca2 into dev Jan 10, 2018
@posva posva deleted the docs/nested-named branch January 10, 2018 16:40
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

Successfully merging this pull request may close these issues.

3 participants