From: Evan You Date: Thu, 24 Jun 2021 14:11:30 +0000 (-0400) Subject: fix(compiler-sfc): fix script setup hidden flag codegen X-Git-Tag: v3.1.3~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5a66c5196f5e00e8cbf7f6008d350d6eabcee71;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): fix script setup hidden flag codegen --- diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index f802bdffdd..a56888a1c2 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -946,11 +946,13 @@ export function compileScript( allBindings[key] = true } } - returned = `{ ${Object.keys(allBindings).join(', ')}${ + const keys = Object.keys(allBindings) + if (!__TEST__) { // the `__isScriptSetup: true` flag is used by componentPublicInstance // proxy to allow properties that start with $ or _ - __TEST__ ? `` : `, __isScriptSetup: true` - } }` + keys.push(`__isScriptSetup: true`) + } + returned = `{ ${keys.join(', ')} }` } s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`)