Skip to content

Commit 9171cbf

Browse files
authored
Update events.md
1 parent d2505e1 commit 9171cbf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/guide/events.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var example2 = new Vue({
6161
data: {
6262
name: 'Vue.js'
6363
},
64-
// 在 `methods`对象中定义方法
64+
// 在 `methods` 对象中定义方法
6565
methods: {
6666
greet: function (event) {
6767
// `this` 在方法里指当前 Vue 实例
@@ -158,9 +158,9 @@ methods: {
158158

159159
## 事件修饰符
160160

161-
在事件处理器中经常需要调用 `event.preventDefault()``event.stopPropagation()`。尽管我们在方法内可以轻松做到,不过让方法是纯粹的数据逻辑而不处理 DOM 事件细节会更好。
161+
在事件处理器中经常需要调用 `event.preventDefault()``event.stopPropagation()` 。尽管我们在方法内可以轻松做到,不过让方法是纯粹的数据逻辑而不处理 DOM 事件细节会更好。
162162

163-
为了解决这个问题,Vue.js 为 `v-on` 提供了 **事件修饰符**。通过点号打头的指令后缀来调用修饰符。
163+
为了解决这个问题, Vue.js 为 `v-on` 提供了 **事件修饰符**。通过点号打头的指令后缀来调用修饰符。
164164

165165
- `.stop`
166166
- `.prevent`
@@ -189,7 +189,7 @@ methods: {
189189

190190
## 按键修饰符
191191

192-
在监听键盘事件时,我们经常需要监测常见的键值。Vue 允许为 `v-on` 在监听键盘事件时添加按键修饰符:
192+
在监听键盘事件时,我们经常需要监测常见的键值。 Vue 允许为 `v-on` 在监听键盘事件时添加按键修饰符:
193193

194194
``` html
195195
<!-- 只有在 keyCode 是 13 时调用 vm.submit() -->
@@ -233,7 +233,7 @@ Vue.config.keyCodes.f1 = 112
233233

234234
## 为什么在 HTML 中监听事件?
235235

236-
你可能注意到这种事件监听的方式违背了传统理念 “separation of concern”。不必担心,因为所有的 Vue.js 事件处理方法和表达式都严格绑定在当前视图的 ViewModel 上,它不会导致任何维护上的困难。实际上,使用 `v-on` 有几个好处:
236+
你可能注意到这种事件监听的方式违背了传统理念 “separation of concern” 。不必担心,因为所有的 Vue.js 事件处理方法和表达式都严格绑定在当前视图的 ViewModel 上,它不会导致任何维护上的困难。实际上,使用 `v-on` 有几个好处:
237237

238238
1. 扫一眼 HTML 模板便能轻松定位在 JavaScript 代码里对应的方法。
239239

0 commit comments

Comments
 (0)