vue v-model值不变的问题

v-model绑定值,当输入法为中文输入法的时候。此时v-model的值还是“我”,而不是“我wo”

clipboard.png

阅读 6k
1 个回答

注意看文档, https://vuejs.org/v2/guide/fo...

v-model will ignore the initial value, checked or selected attributes found on any form elements. It will always treat the Vue instance data as the source of truth. You should declare the initial value on the JavaScript side, inside the data option of your component.

For languages that require an IME (Chinese, Japanese, Korean etc.), you’ll notice that v-model doesn’t get updated during IME composition. If you want to cater for these updates as well, use input event instead.

就是说 v-model就是监听的change,而不是input,在pc上面这两个是有区别。

推荐问题