3
如果不使用v模型,如何在鍵入時檢索文本字段的值?如果可能,不使用任何方法。獲取文本字段值onkeyup vue js
<input type="text" class="form-field"
v-on:keyup="data.sample = this.target.value">
我用
- THIS.VALUE
this.target.value
e.target.value
如果不使用v模型,如何在鍵入時檢索文本字段的值?如果可能,不使用任何方法。獲取文本字段值onkeyup vue js
<input type="text" class="form-field"
v-on:keyup="data.sample = this.target.value">
我用
this.target.value
e.target.value
的解決方案是:
<input type="text" v-on:keyup="this.$data.name = $event.target.value">
在收聽本地DOM事件,該方法接收的本地事件作爲唯一的參數。如果使用直列語句,該語句訪問特殊$事件屬性:V系列:點擊= 「手柄( 'OK',$事件)」