Преглед изворни кода

fix(v-model): use consistent behavior during IME composition for other text-like input types (fix #5902)

Evan You пре 9 година
родитељ
комит
4acc8c8be1
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      src/platforms/web/runtime/directives/model.js

+ 4 - 2
src/platforms/web/runtime/directives/model.js

@@ -3,9 +3,11 @@
  * properties to Elements.
  */
 
-import { looseEqual, looseIndexOf } from 'shared/util'
+import { looseEqual, looseIndexOf, makeMap } from 'shared/util'
 import { warn, isAndroid, isIE9, isIE, isEdge } from 'core/util/index'
 
+const isTextInputType = makeMap('text,password,search,email,tel,url')
+
 /* istanbul ignore if */
 if (isIE9) {
   // http://www.matts411.com/post/internet-explorer-9-oninput/
@@ -28,7 +30,7 @@ export default {
       if (isIE || isEdge) {
         setTimeout(cb, 0)
       }
-    } else if (vnode.tag === 'textarea' || el.type === 'text' || el.type === 'password') {
+    } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
       el._vModifiers = binding.modifiers
       if (!binding.modifiers.lazy) {
         // Safari < 10.2 & UIWebView doesn't fire compositionend when