Skip to content

Commit

Permalink
fix(compiler): stringify values on v-text
Browse files Browse the repository at this point in the history
Close #2430
  • Loading branch information
posva committed Oct 19, 2020
1 parent 2d5784c commit 0c851fd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/compiler-dom/src/transforms/vText.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
DirectiveTransform,
createObjectProperty,
createSimpleExpression
createSimpleExpression,
TO_DISPLAY_STRING,
createCallExpression
} from '@vue/compiler-core'
import { createDOMCompilerError, DOMErrorCodes } from '../errors'

Expand All @@ -21,8 +23,14 @@ export const transformVText: DirectiveTransform = (dir, node, context) => {
return {
props: [
createObjectProperty(
createSimpleExpression(`textContent`, true, loc),
exp || createSimpleExpression('', true)
createSimpleExpression(`textContent`, true),
exp
? createCallExpression(
context.helperString(TO_DISPLAY_STRING),
[exp],
loc
)
: createSimpleExpression('', true)
)
]
}
Expand Down

0 comments on commit 0c851fd

Please sign in to comment.