Skip to content

Commit

Permalink
fix: 手动传入 class 时,使用 Object.create 创建 instance
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg committed Dec 3, 2021
1 parent 601d79a commit 2ad9def
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compilers/renderer-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ export class RendererCompiler {

private compileGenInstance (info: ComponentInfo) {
if (this.options.useProvidedComponentClass) {
return DEF('instance', new BinaryExpression(I('ComponentClass'), '.', I('prototype')))
return DEF('instance', new FunctionCall(
BINARY(I('Object'), '.', I('create')),
[BINARY(I('ComponentClass'), '.', I('prototype'))]
))
}

return DEF('instance', new CreateComponentInstance(info))
Expand Down

0 comments on commit 2ad9def

Please sign in to comment.