fix(compiler-sfc): fix script setup hidden flag codegen

This commit is contained in:
Evan You 2021-06-24 10:11:30 -04:00
parent ac853ff4ab
commit a5a66c5196

View File

@ -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`)