1 min read
BaseEventButton
BaseEventButton
Component to be reused that renders a <button>
with the logic of emitting events to the bus on
click. The events are passed as an object to prop XEvent. The keys are the event name and the values
are the payload of each event. All events are emitted with its respective payload. If any event
doesn't need payload a undefined
must be passed as value.
Props
Name | Description | Type | Default |
---|---|---|---|
events | An object where the keys are the XEvent and the values are the payload. | Partial |
|
metadata | The metadata property for the request on each query preview. | Omit<WireMetadata, 'moduleName'> |
|
Slots
Name | Description | Bindings (name - type - description) |
---|---|---|
default | (Required) Button content with a text, an icon or both | None |
Examples
Basic example
The event prop is required. It will render a that emits the event passed as prop with the value as payload on click:
<BaseEventButton :events="{ myEvent: payload }" />
If the event doesn't need payload then undefined
must be passed:
<BaseEventButton :events="{ myEvent: undefined }" />
It can emit multiple events at the same time:
<BaseEventButton :events="{ myFirstEvent: payload1, mySecondEvent: payload2 }" />