fix(compiler-dom): avoid bailing stringification on setup const bindings
This commit is contained in:
@@ -14,7 +14,8 @@ import {
|
||||
ElementTypes,
|
||||
PlainElementNode,
|
||||
JSChildNode,
|
||||
TextCallNode
|
||||
TextCallNode,
|
||||
ConstantTypes
|
||||
} from '@vue/compiler-core'
|
||||
import {
|
||||
isVoidTag,
|
||||
@@ -171,7 +172,7 @@ const isNonStringifiable = /*#__PURE__*/ makeMap(
|
||||
|
||||
/**
|
||||
* for a hoisted node, analyze it and return:
|
||||
* - false: bailed (contains runtime constant)
|
||||
* - false: bailed (contains non-stringifiable props or runtime constant)
|
||||
* - [nc, ec] where
|
||||
* - nc is the number of nodes inside
|
||||
* - ec is the number of element with bindings inside
|
||||
@@ -216,6 +217,13 @@ function analyzeNode(node: StringifiableNode): [number, number] | false {
|
||||
) {
|
||||
return bail()
|
||||
}
|
||||
if (
|
||||
p.exp &&
|
||||
(p.exp.type === NodeTypes.COMPOUND_EXPRESSION ||
|
||||
p.exp.constType < ConstantTypes.CAN_STRINGIFY)
|
||||
) {
|
||||
return bail()
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user