Decorator to create a component backed by a Vue template.
def component_vue(vue_path: str, vuetify=True) -> Callable[[Callable[P, None]], Callable[P, solara.Element]]:
Although many components can be made from the Python side, sometimes it is easier to write components using Vue directly. It can also be beneficial for performance, since instead of creating many widgets from the Python side we only send data to the frontend. If event handling is also done on the frontend, this reduces latency and makes you app feel much smoother.
All arguments of the function are exposed as Vue properties. Argument pairs of the form
are assumed by refer to the same vue property, with
on_foo being the event handler when
foo changes from
the vue template.
Arguments or the form
event_foo should be callbacks that can be called from the vue template. They are
available as the function
foo in the vue template.
See the vue v2 api for more information on how to use Vue, like
methods and lifecycle hooks such as
See the Vue component example for an example of how to use this decorator.
vue_path: The path to the Vue template file.
vuetify: Whether the Vue template uses Vuetify components.