2

Two equal examples (according to Vue.js) work differently:

First

<input v-model="value" @input.once="setDirty" type="text" id="object-email">

Second:

<input v-bind:value="value" v-on:input="value = $event.target.value"
                   @input.once="setDirty"
                   type="text"
                   id="object-email">

In the first example value changes only after second input, while the second example works correctly. If we delete @input.once attribute, two examples will work fine.

P.S. Vue 2.4.0

4

1 回答 1

0

这是在2.4.3版本中修复的错误

作为以前版本的解决方法,您可以简单地使用@keydown.once="setDirty"而不是@input.once.

于 2017-09-08T14:16:24.783 回答