framework: server.registerRenderer

This commit is contained in:
undefined committed 2024-06-07 07:10:36 +08:00
1 parent d82dd2b04d
commit 59c1b83b50
6 files changed
+24 -11

No files matched your search

+6
View File
@@ -78,6 +78,12 @@ export class Handler extends HandlerOriginal {
constructor(_, ctx: Context) {
super(_, ctx);
this.ctx = ctx.extend({ domain: this.domain });
this.renderHTML = ((orig) => function (name: string, args: Record<string, any>) {
const s = name.split('.');
let templateName = `${s[0]}.${args.domainId}.${s[1]}`;
if (!global.Hydro.ui.template[templateName]) templateName = name;
return orig(templateName, args);
})(this.renderHTML).bind(this);
}
async onerror(error: HydroError) {