Skip to content

Commit

Permalink
fix(runtime-dom): directives trim & number, number is not effect
Browse files Browse the repository at this point in the history
  • Loading branch information
liulinboyi committed May 2, 2022
1 parent 4a3237a commit bd22aa8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/runtime-core/src/componentEmits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ export function emit(
const { number, trim } = props[modifiersKey] || EMPTY_OBJ
if (trim) {
args = rawArgs.map(a => a.trim())
} else if (number) {
}
if (number) {
args = rawArgs.map(toNumber)
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/runtime-dom/src/directives/vModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export const vModelText: ModelDirective<
let domValue: string | number = el.value
if (trim) {
domValue = domValue.trim()
} else if (castToNumber) {
}
if (castToNumber) {
domValue = toNumber(domValue)
}
el._assign(domValue)
Expand Down

0 comments on commit bd22aa8

Please sign in to comment.