feat: Call custom block loaders with Component
as argument
#664
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.
I love the idea of single file vue components and of being able to add custom blocks such as
<docs>
. Although it is possible to pass arguments to the loader via attributes on the custom block tag, you cannot access theComponent
from inside the loader. I needed that functionality to achieve the following.<docs>
tag in the .vue fileoptions._docs
so that it would be accessible during runtime.A very simple custom loader for this task could, for example, look like this:
So I changed the call of the customBlock to include
Component
, if the result of therequire
is a function. I'm not sure if this would break any existing workflows.If you think this use case is worth considering I'd be happy to supply the corresponding unit tests and docs.