File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ methods: {
190
190
<div v-on:click.self =" doThat" >...</div >
191
191
```
192
192
193
+ <p class =" tip " >使用修饰服时,顺序很重要;相应的代码会以同样的顺序产生。因此,用 `@click.prevent.self` 会阻止**所有的点击**,而 `@click.self.prevent` 只会阻止元素上的点击。</p >
194
+
193
195
> 2.1.4 新增
194
196
195
197
``` html
@@ -258,6 +260,18 @@ Vue.config.keyCodes.f1 = 112
258
260
<div @click.ctrl =" doSomething" >Do something</div >
259
261
```
260
262
263
+ <p class =" tip " >修饰符键比正常的按键不同;修饰符键和 `keyup` 事件一起用时,事件引发时必须按下正常的按键。换一种说法:如果要引发 `keyup.ctrl`,必须按下 `ctrl` 时释放其他的按键;单单释放 `ctrl` 不会引发事件。</p >
264
+
265
+ ### 滑鼠按键修饰符
266
+
267
+ > 2.1.0 新增
268
+
269
+ - ` .left `
270
+ - ` .right `
271
+ - ` .middle `
272
+
273
+ 这些修饰符会限制处理程序监听特定的滑鼠按键。
274
+
261
275
## 为什么在 HTML 中监听事件?
262
276
263
277
你可能注意到这种事件监听的方式违背了关注点分离(separation of concern)传统理念。不必担心,因为所有的 Vue.js 事件处理方法和表达式都严格绑定在当前视图的 ViewModel 上,它不会导致任何维护上的困难。实际上,使用 ` v-on ` 有几个好处:
Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ new Vue({
179
179
``` html
180
180
<div id =" example-5" >
181
181
<select v-model =" selected" >
182
+ <option disabled value =" " >请选择</option >
182
183
<option >A</option >
183
184
<option >B</option >
184
185
<option >C</option >
@@ -199,6 +200,7 @@ new Vue({
199
200
{% raw %}
200
201
<div id =" example-5 " >
201
202
<select v-model =" selected " >
203
+ <option disabled value="">请选择</option>
202
204
<option>A</option>
203
205
<option>B</option>
204
206
<option>C</option>
@@ -215,6 +217,8 @@ new Vue({
215
217
</script >
216
218
{% endraw %}
217
219
220
+ <p class =" tip " >如果 `v-model` 表达初始的值不相配任何的选择,`<select >` 元素就会以"未选中"的状态渲染。在 iOS,这会使用者无法选择第一个选择,因为这样的情况下, iOS 不会引发 change 事件。因此,像以上提供 disabled 选择是建议的做法。</p >
221
+
218
222
多选列表(绑定到一个数组):
219
223
220
224
``` html
You can’t perform that action at this time.
0 commit comments