-
Notifications
You must be signed in to change notification settings - Fork 0
remote.Function.createDomHandler
github-actions[bot] edited this page Jun 8, 2026
·
2 revisions
@zenstone/ts-utils / remote / createDomHandler
createDomHandler(
tagName,setup):MountHandlerFn<MountDomOptions,MountDomResult>
Defined in: src/remote/mountRemote.ts:142
创建基于 DOM 元素的挂载处理器
适用于通过 script/link 等标签加载的资源。自动处理:
-
getElementById短路检查 - 创建元素并设置属性
- 设置 id(使用 scope)
- 监听 load/error 事件
- 挂载到 document.head
string
标签名
(el, ctx) => void
元素初始化函数
MountHandlerFn<MountDomOptions, MountDomResult>
registerMountHandler('img', createDomHandler('img', (el, ctx) => {
el.setAttribute('src', ctx.url);
}));