Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Use control component in widget sub component #9

Open
jonaswjs opened this issue Nov 10, 2017 · 1 comment
Open

Use control component in widget sub component #9

jonaswjs opened this issue Nov 10, 2017 · 1 comment

Comments

@jonaswjs
Copy link
Member

To separate a big widget in multiple components it would be great if we can use the controls of the widget.

When using a test-control in a sub component of a widget, which has the test-control listed in the widget.json I get the following warning:

[Vue warn]: Unknown custom element: <test-control> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
@x1B
Copy link
Member

x1B commented Nov 10, 2017

@jonaswjs I agree that this feature would be very useful. However, I am not sure if/how this can be done with VueJS.

For now, I think that there are two options:

  • Put everything into the widget as sub-components — of course, then you won't be able to use a control from multiple widgets.

  • Or, package all sub-components as controls (then, you can declare the sub-controls from within the controls.json). You might prefix their names with the widget name to indicate the association.

Alternatively, you might be able to register controls globally from within the widget's create method. Of course, then they'll be available anywhere.

It might also be possible to pass controls from a widget to a sub-component by passing the control itself as a prop and loading it through an async wrapper component into the child, but we have not tried this yet.

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

No branches or pull requests

2 participants