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

support for custom router implementations #13

Closed
stefanhoelzl opened this issue Jun 20, 2020 · 1 comment
Closed

support for custom router implementations #13

stefanhoelzl opened this issue Jun 20, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@stefanhoelzl
Copy link
Owner

@vadolasi made in #12 the proposal to support custom vue router implementations.
An example how to use such a implementation with vue.js is shown here

parameter proposal

The initial proposal looks like this

class VueRouter(Wrapper):
    @classmethod
    def init_dict(cls):
        return VueRouterFactory.get_item(cls)

    def __new__(cls, vue_router_class=window.VueRouter):
        return vue_router_class.new(cls.init_dict())

using this would look like this

class Router(VueRouter):
    routes = []

App("#app", router=Router(vue_router_class=window.CustomRouter))

class attribute proposal

another proposal could look like this

class VueRouter(Wrapper):
    RouterClass = window.VueRouter

    @classmethod
    def init_dict(cls):
        return VueRouterFactory.get_item(cls)

    def __new__(cls):
        return RouterClass.new(cls.init_dict())

using this would look like this

class Router(VueRouter):
    RouterClass = window.CustomRouter
    routes = []

App("#app", router=Router())

The advantage of the class attribute proposal would be that the definition of the custom implementation and the declaration of the actual Router class is together.
This means by looking at the Router implementation it can be understood completely.
And it is also closer to the definition of other vue.py objects, where most of the functionality is described by class attributes/methods.

In the other proposal to understand the whole Router implementation someone also has to look at the App initialization.

So I would propose to implement the class attribute proposal.
@vadolasi does this work for your use case?

@stefanhoelzl stefanhoelzl added the enhancement New feature or request label Jun 20, 2020
@vadolasi
Copy link
Contributor

Yes, it would look even better this way.

stefanhoelzl added a commit that referenced this issue Feb 13, 2021
* Features
  * support for custom router (#13)
  * Add support for missing route params (#12)
* Bugfixes
  * fixes flask requirement (#17)
  * components used in routes did not work properly
stefanhoelzl added a commit that referenced this issue Feb 13, 2021
* Features
  * support for custom router (#13)
  * Add support for missing route params (#12)
* Bugfixes
  * fixes flask requirement (#17)
  * components used in routes did not work properly
stefanhoelzl added a commit that referenced this issue Feb 15, 2021
* Features
  * support for custom router (#13)
  * Add support for missing route params (#12)
* Bugfixes
  * fixes flask requirement (#17)
  * components used in routes did not work properly
stefanhoelzl added a commit that referenced this issue Feb 15, 2021
* Features
  * support for custom router (#13)
  * Add support for missing route params (#12)
* Bugfixes
  * fixes flask requirement (#17)
  * components used in routes did not work properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants