spz-event

Listen to the given event, when the event is triggered, execute the target API.

布局

In the following code, the render action of the spz-render#cart-count will be triggered when the dj.addToCart and dj.cartChange events are triggered.

<spz-render layout="container" id="cart-count" manual>
  <!-- ... -->
</spz-render>

<spz-event
  target-id="cart-count"
  target-api="render"
  event-name="dj.addToCart;dj.cartChange;"
  layout="logic"
></spz-event>

Specifies one or more names of the event that separates by a ;. Such as event-name="dj.addToCart;dj.cartChange;".

Specifies the id of the element that needs to call an API when the event is triggered.

Specifies the API of the element that needs to call when the event is triggered. Its default value is render.

Specifies an element of observation that has been loaded to execute an API of the target element.

Specifies a milliseconds that delays calling an API when the event is triggered. Its default value is 0.

Remove the event that has been listened to.

Parameter Description Type Required
eventName Remove event listener string Yes
本页目录