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

Add vue-router helper classes and example #37

Merged
merged 4 commits into from Feb 1, 2022

Conversation

DavidBerger98
Copy link
Contributor

@DavidBerger98 DavidBerger98 commented Jan 28, 2022

Simple demo to use the Vue-Router in Trame to create multi-page applications.

I suggest two ways to add a new route. layout.add_route and layout.with_route. See the example.

Any more/other suggestions?

(Depends on this PR in py-web-vue: Kitware/py-web-vue#11)

@DavidBerger98 DavidBerger98 changed the title Add router helper classes and example Add vue-router helper classes and example Jan 28, 2022
class RouterView(AbstractElement):
def __init__(self, children=None, **kwargs):
super().__init__("router-view", children=children, **kwargs)
self._attr_names += []
Copy link
Collaborator

@jourdain jourdain Jan 28, 2022

Choose a reason for hiding this comment

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

can remove that line self._attr_names += []

"name": name,
"path": path,
"component": {
"template": template.html,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You may want to defer the template.html evaluation to later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe you just pass the template to template and you do a pass somewhere in layout.start to eval to html any isinstance(template, AbstractElement).

@jourdain
Copy link
Collaborator

BTW, I love the idea!

@jourdain
Copy link
Collaborator

I guess, you just need to resolve the conflict. Otherwise it looks good.

@DavidBerger98
Copy link
Contributor Author

Thank you for the review, @jourdain :)

@jourdain
Copy link
Collaborator

jourdain commented Feb 1, 2022

Thanks for your contribution!

@jourdain jourdain merged commit 94c613a into Kitware:master Feb 1, 2022
@jourdain
Copy link
Collaborator

jourdain commented Feb 1, 2022

🎉 This PR is included in version 1.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@DavidBerger98
Copy link
Contributor Author

BTW, don't forget to merge the PR for py-web-vue as well, since this PR depends on it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants