Skip to content

Commit 45f2d9e

Browse files
authored
fix(docs): initialise data, fix typo in x-on example (#4701)
1 parent 99d8670 commit 45f2d9e

File tree

1 file changed

+3
-1
lines changed
  • packages/docs/src/en/directives

1 file changed

+3
-1
lines changed

packages/docs/src/en/directives/on.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ Here's an example of a button that changes behaviour when the `Shift` key is hel
113113

114114
```alpine
115115
<button type="button"
116+
x-data="{ message: 'select' }"
116117
@click="message = 'selected'"
117-
@click.shift="message = 'added to selection'">
118+
@click.shift="message = 'added to selection'"
118119
@mousemove.shift="message = 'add to selection'"
119120
@mouseout="message = 'select'"
120121
x-text="message"></button>
@@ -124,6 +125,7 @@ Here's an example of a button that changes behaviour when the `Shift` key is hel
124125
<div class="demo">
125126
<div x-data="{ message: '' }">
126127
<button type="button"
128+
x-data="{ message: 'select' }"
127129
@click="message = 'selected'"
128130
@click.shift="message = 'added to selection'"
129131
@mousemove.shift="message = 'add to selection'"

0 commit comments

Comments
 (0)