feat(vModel): handle true-value and false-value for checkbox (#449)
This commit is contained in:
committed by
Evan You
parent
0ef999bef1
commit
fe66194a77
@@ -5,9 +5,9 @@ import { patchDOMProp } from './modules/props'
|
||||
import { patchEvent } from './modules/events'
|
||||
import { isOn } from '@vue/shared'
|
||||
import {
|
||||
VNode,
|
||||
ComponentInternalInstance,
|
||||
SuspenseBoundary
|
||||
SuspenseBoundary,
|
||||
VNode
|
||||
} from '@vue/runtime-core'
|
||||
|
||||
export function patchProp(
|
||||
@@ -53,6 +53,15 @@ export function patchProp(
|
||||
unmountChildren
|
||||
)
|
||||
} else {
|
||||
// special case for <input v-model type="checkbox"> with
|
||||
// :true-value & :false-value
|
||||
// store value as dom properties since non-string values will be
|
||||
// stringified.
|
||||
if (key === 'true-value') {
|
||||
;(el as any)._trueValue = nextValue
|
||||
} else if (key === 'false-value') {
|
||||
;(el as any)._falseValue = nextValue
|
||||
}
|
||||
patchAttr(el, key, nextValue)
|
||||
}
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user