fix(runtime-core): inject function support self-inject #3022
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this pull request, I have read #1818 and #2400. And I think self-inject feature is required.
I wrote a vue3 plugin that depends on self-inject. Without self-inject feature, every container component must be splited into two components.
We can learn from angular. In angular, we can define component scope providers. By default we can self-inject.
And we can use
@Skip
to inject from parent.WARNING!!! In this pull request, by default we inject from parent, and use
selfInject
parameter to control whether or not self-inject.By the way. I don't think v3.0.2 is a patch update. It should be a minor update at least. It is not a compatible update.
![image](https://user-images.githubusercontent.com/4965664/104687179-a6e96c80-5739-11eb-9e5b-5a7afc72d54f.png)
@CyberAP @69hunter