]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(v-model): exclude range from lazy guard logic
authorEvan You <yyx990803@gmail.com>
Thu, 12 May 2022 10:39:17 +0000 (18:39 +0800)
committerEvan You <yyx990803@gmail.com>
Thu, 12 May 2022 10:39:17 +0000 (18:39 +0800)
fix #5875

packages/runtime-dom/src/directives/vModel.ts

index b3e10a2a1c2cd6994de4d0fca2e8da0b511a8111..3d05e9fa47fe77d6e25e0d0016716de342767098 100644 (file)
@@ -18,7 +18,9 @@ import {
 type AssignerFn = (value: any) => void
 
 const getModelAssigner = (vnode: VNode): AssignerFn => {
-  const fn = vnode.props!['onUpdate:modelValue'] || (__COMPAT__ && vnode.props!['onModelCompat:input'])
+  const fn =
+    vnode.props!['onUpdate:modelValue'] ||
+    (__COMPAT__ && vnode.props!['onModelCompat:input'])
   return isArray(fn) ? value => invokeArrayFns(fn, value) : fn
 }
 
@@ -78,7 +80,7 @@ export const vModelText: ModelDirective<
     el._assign = getModelAssigner(vnode)
     // avoid clearing unresolved text. #2302
     if ((el as any).composing) return
-    if (document.activeElement === el) {
+    if (document.activeElement === el && el.type !== 'range') {
       if (lazy) {
         return
       }