getPrefixedEventHandlers

Commons
stable

Filters event-handler attrs by a trailing suffix, strips the suffix, and wraps each handler so it receives an extra getData argument. Used internally to forward scoped event listeners through component boundaries.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

attrs
requis
Record<string, any>
The raw attrs object from $attrs / useAttrs(). Only keys that pass isOn() and end with the given suffix are selected.
suffix
requis
T
A colon-prefixed suffix string (e.g. ":input"). Event handler keys ending with this suffix are matched and stripped.
getData
requis
TEventHandler
A function called with each event to produce the extra data argument forwarded to the original handler.

API

Valeur de retour

La valeur retournée par cet util.

An object keyed by the stripped event handler names, each wrapping the original handler with the extra getData call.

Usage

Exemples

Extraits de code prêts à coller.

Forward scoped event handlers

typescript