fix(compiler-core): improve handling of v-bind shorthand for in-DOM templates

This commit is contained in:
daiwei 2025-09-26 20:55:01 +08:00
parent 5a8aa0b2ba
commit 4685dac18f
1 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,12 @@ export const transformVBindShorthand: NodeTransform = (node, context) => {
if ( if (
prop.type === NodeTypes.DIRECTIVE && prop.type === NodeTypes.DIRECTIVE &&
prop.name === 'bind' && prop.name === 'bind' &&
!prop.exp (!prop.exp ||
// #13930 :foo will be processed as :foo="" in in-DOM template
(__BROWSER__ &&
prop.exp.type === NodeTypes.SIMPLE_EXPRESSION &&
!prop.exp.isStatic &&
!prop.exp.content))
) { ) {
const arg = prop.arg! const arg = prop.arg!
if (arg.type !== NodeTypes.SIMPLE_EXPRESSION || !arg.isStatic) { if (arg.type !== NodeTypes.SIMPLE_EXPRESSION || !arg.isStatic) {