diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index db04dbef333..6ee54818c7a 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -1815,6 +1815,8 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor, isTS: boolean) { if (value) { code += `,${processExp(value, isTS, baseName)}` } + } else if (name === 'ref') { + code += `,${value}` } } }, diff --git a/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap index bb52a66b907..82b305c4255 100644 --- a/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap @@ -348,6 +348,20 @@ return { vMyDir } })" `; +exports[`SFC compile + + `) + expect(content).toMatch(`return { aref }`) + assertCode(content) + }) + test('vue interpolations', () => { const { content } = compile(`