إدخال كلمة المرور · الحدث
الاشتراك في تغييرات الظهور من LiveView أو العميل.
عند تغيير الظهور (الخادم)
| Time | Source | Value |
|---|---|---|
|
No event yet. Interact with the components to receive new events |
||
<.password_input
class="password-input"
name="user[password]"
on_visibility_change="password_visibility_changed"
>
<:label>Password</:label>
<:visible_indicator><.heroicon name="hero-eye" class="icon" /></:visible_indicator>
<:hidden_indicator><.heroicon name="hero-eye-slash" class="icon" /></:hidden_indicator>
</.password_input>
def handle_event("password_visibility_changed", %{"id" => id, "visible" => visible} = params, socket) do
IO.inspect(params, label: "password_visibility_changed")
{:noreply, socket}
end
عند تغيير الظهور (العميل)
| Time | Source | Value |
|---|---|---|
|
No event yet. Interact with the components to receive new events |
||
<.password_input
class="password-input"
name="user[password]"
on_visibility_change_client="password-visibility-changed"
>
<:label>Password</:label>
<:visible_indicator><.heroicon name="hero-eye" class="icon" /></:visible_indicator>
<:hidden_indicator><.heroicon name="hero-eye-slash" class="icon" /></:hidden_indicator>
</.password_input>
const el = document.getElementById(\"password-input-events-client\");
el?.addEventListener(\"password-visibility-changed\", (event) => console.log(event.detail));
const el = document.getElementById(\"password-input-events-client\");
el?.addEventListener(\"password-visibility-changed\", (event: Event) =>
console.log((event as CustomEvent<unknown>).detail)
);