Răsfoiți Sursa

Add documentation for `.dot` modifier (#2253)

Benni 3 ani în urmă
părinte
comite
6b9611b589
1 a modificat fișierele cu 13 adăugiri și 0 ștergeri
  1. 13 0
      packages/docs/src/en/directives/on.md

+ 13 - 0
packages/docs/src/en/directives/on.md

@@ -262,6 +262,19 @@ Sometimes you may want to listen for camelCased events such as `customEvent` in
 
 By adding `.camel` in the above example, Alpine is now listening for `customEvent` instead of `custom-event`.
 
+<a name="dot"></a>
+### .dot
+
+```alpine
+<div @custom-event.dot="handleCustomEvent">
+    ...
+</div>
+```
+
+Similar to the `.camelCase` modifier there may be situations where you want to listen for events that have dots in their name (like `custom.event`). Since dots within the event name are reserved by Alpine you need to write them with dashes and add the `.dot` modifier.
+
+In the code example above `custom-event.dot` will correspond to the event name `custom.event`.
+
 <a name="passive"></a>
 ### .passive