Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render only component #165

Merged
merged 15 commits into from
Apr 17, 2023
Prev Previous commit
Next Next commit
feat: client-render
  • Loading branch information
meixg committed Mar 1, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
addaleax Anna Henningsen
commit d29e261dffbbfa09da66212ade6f1f4c70823cd4
11 changes: 8 additions & 3 deletions src/compilers/renderer-compiler.ts
Original file line number Diff line number Diff line change
@@ -38,15 +38,20 @@ export class RendererCompiler {
// 参数太多了,后续要增加的参数统一收敛到这里
DEF('...info')
]
const fn = new FunctionDefinition(this.options.functionName || '', args,
componentInfo.componentType === 'template'
const rendererFunctionBody = componentInfo.ssrType === 'client-render'
? this.compileClientRendererBody()
: componentInfo.componentType === 'template'
? this.compileTemplateComponentRendererBody(componentInfo)
: this.compileComponentRendererBody(componentInfo)
)
const fn = new FunctionDefinition(this.options.functionName || '', args, rendererFunctionBody)
mergeLiteralAdd(fn)
return fn
}

private compileClientRendererBody () {
return [RETURN(L(''))]
}

private compileComponentRendererBody (info: ComponentInfo) {
const body = []
// 没有 ANode 的组件,比如 load-success 样例