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

The way to extends a Trait. #594

Open
tanbowensg opened this issue Sep 7, 2022 · 1 comment
Open

The way to extends a Trait. #594

tanbowensg opened this issue Sep 7, 2022 · 1 comment
Labels
feature New feature or request runtime about meta-ui runtime

Comments

@tanbowensg
Copy link
Collaborator

What problem does this feature solve?
Sometimes traits need to be extended. For example, Validation Trait presets some rules, but the business logic always requires custom validation rules. Validation Trait needs to receive and register custom rules.

What does the proposed API look like?
Since the trait is a factory function, so one of the ways may be injecting dependencies in the trait's constructor function. And trait's dependencies can be passed in initSunmao(not the dependencies filed, but a new field).

@tanbowensg tanbowensg added feature New feature or request runtime about meta-ui runtime labels Sep 7, 2022
@Yuyz0112
Copy link
Contributor

How about

  1. Pass the extended things as props if they are serializable.
  2. Implement a new trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request runtime about meta-ui runtime
Projects
None yet
Development

No branches or pull requests

2 participants