本文整理汇总了TypeScript中@aurelia/runtime.IDOM.appendChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IDOM.appendChild方法的具体用法?TypeScript IDOM.appendChild怎么用?TypeScript IDOM.appendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@aurelia/runtime.IDOM
的用法示例。
在下文中一共展示了IDOM.appendChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: switch
function addChildren<T extends INode>(dom: IDOM<T>, parent: T, children: ArrayLike<unknown>, allInstructions: HTMLTargetedInstruction[][], dependencies: IRegistry[]): void {
for (let i = 0, ii = children.length; i < ii; ++i) {
const current = children[i];
switch (typeof current) {
case 'string':
dom.appendChild(parent, dom.createTextNode(current));
break;
case 'object':
if (dom.isNodeInstance(current)) {
dom.appendChild(parent, current);
} else if ('mergeInto' in (current as RenderPlan)) {
(current as RenderPlan<T>).mergeInto(parent, allInstructions, dependencies);
}
}
}
}
示例2: mergeInto
/** @internal */
public mergeInto(parent: T, instructions: HTMLTargetedInstruction[][], dependencies: IRegistry[]): void {
this.dom.appendChild(parent, this.node);
instructions.push(...this.instructions);
dependencies.push(...this.dependencies);
}