Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 03093c1

Browse files
in events guide, only alert tagName if event exists
1 parent 0aff75e commit 03093c1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/v2/guide/events.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ var example2 = new Vue({
6767
// `this` inside methods points to the Vue instance
6868
alert('Hello ' + this.name + '!')
6969
// `event` is the native DOM event
70-
alert(event.target.tagName)
70+
if (event) {
71+
alert(event.target.tagName)
72+
}
7173
}
7274
}
7375
})
@@ -91,7 +93,9 @@ var example2 = new Vue({
9193
methods: {
9294
greet: function (event) {
9395
alert('Hello ' + this.name + '!')
94-
alert(event.target.tagName)
96+
if (event) {
97+
alert(event.target.tagName)
98+
}
9599
}
96100
}
97101
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /