Skip to content

Commit 3fefe1d

Browse files
author
ntepluhina
committed
fix: fixed events doc
1 parent ca4340c commit 3fefe1d

File tree

1 file changed

+29
-38
lines changed

1 file changed

+29
-38
lines changed

src/guide/events.md

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@ For example:
1616
```
1717

1818
```js
19-
Vue.createApp().mount(
20-
{
21-
data() {
22-
return {
23-
counter: 1
24-
}
25-
}
26-
},
27-
'#example-1'
28-
)
19+
Vue.createApp({
20+
data() {
21+
return {
22+
counter: 1
23+
};
24+
}
25+
}).mount("#example-1");
2926
```
3027

3128
Result:
@@ -46,26 +43,23 @@ For example:
4643
```
4744

4845
```js
49-
Vue.createApp().mount(
50-
{
51-
data() {
52-
return {
53-
name: 'Vue.js'
54-
}
55-
},
56-
methods: {
57-
greet(event) {
58-
// `this` inside methods points to the Vue instance
59-
alert('Hello ' + this.name + '!')
60-
// `event` is the native DOM event
61-
if (event) {
62-
alert(event.target.tagName)
63-
}
46+
Vue.createApp({
47+
data() {
48+
return {
49+
name: "Vue.js"
50+
};
51+
},
52+
methods: {
53+
greet(event) {
54+
// `this` inside methods points to the Vue instance
55+
alert("Hello " + this.name + "!");
56+
// `event` is the native DOM event
57+
if (event) {
58+
alert(event.target.tagName);
6459
}
6560
}
66-
},
67-
'#example-2'
68-
)
61+
}
62+
}).mount("#example-2");
6963
```
7064

7165
Result:
@@ -84,16 +78,13 @@ Instead of binding directly to a method name, we can also use methods in an inli
8478
```
8579

8680
```js
87-
Vue.createApp().mount(
88-
{
89-
methods: {
90-
say(message) {
91-
alert(message)
92-
}
81+
Vue.createApp({
82+
methods: {
83+
say(message) {
84+
alert(message);
9385
}
94-
},
95-
'#example-3'
96-
)
86+
}
87+
}).mount("#example-3");
9788
```
9889

9990
Result:
@@ -229,7 +220,7 @@ You can also [define custom key modifier aliases](TODO:../api/#keyCodes) via the
229220

230221
```js
231222
// enable `v-on:keyup.f1`
232-
Vue.config.keyCodes.f1 = 112
223+
Vue.config.keyCodes.f1 = 112;
233224
```
234225

235226
## System Modifier Keys

0 commit comments

Comments
 (0)