Skip to content

Commit

Permalink
fix(v-model): fix input change check for type="number"
Browse files Browse the repository at this point in the history
The change should only apply to the .number modifier, not type="number".
fix #6069
  • Loading branch information
yyx990803 committed Jul 11, 2017
1 parent fed602b commit 0a9aab5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/platforms/web/compiler/directives/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function genDefaultModel (

addProp(el, 'value', `(${value})`)
addHandler(el, event, code, null, true)
if (trim || number || type === 'number') {
if (trim || number) {
addHandler(el, 'blur', '$forceUpdate()')
}
}
2 changes: 1 addition & 1 deletion src/platforms/web/runtime/directives/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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')
const isTextInputType = makeMap('text,number,password,search,email,tel,url')

/* istanbul ignore if */
if (isIE9) {
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/web/runtime/modules/dom-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function isDirty (elm: acceptValueElm, checkVal: string): boolean {
function isInputChanged (elm: any, newVal: string): boolean {
const value = elm.value
const modifiers = elm._vModifiers // injected by v-model runtime
if ((isDef(modifiers) && modifiers.number) || elm.type === 'number') {
if (isDef(modifiers) && modifiers.number) {
return toNumber(value) !== toNumber(newVal)
}
if (isDef(modifiers) && modifiers.trim) {
Expand Down

0 comments on commit 0a9aab5

Please sign in to comment.