diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 2c0f9f246..275945a2b 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -1818,6 +1818,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 601abd2ee..4b81610a4 100644 --- a/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap @@ -364,6 +364,20 @@ return { vMyDir } })" `; +exports[`SFC compile + + `) + expect(content).toMatch(`return { aref }`) + assertCode(content) + }) + test('vue interpolations', () => { const { content } = compile(`