呈现内容布局

ContentLayoutrender(params) 方法基于模板呈现内容布局。默认情况下,呈现内容布局时使用 Mustache 模板,但您可以使用所需的任何模板技术。

ContentLayoutrender(params) 方法可以使用以下代码来提供数据并呈现模板:

try {
    // Mustache
    template = Mustache.render(templateHtml, content);
    if (template) {
        $(parentObj).append(template);
    }

    // Dynamic DOM Manipulation can be done here

} catch (e) {
    console.error(e.stack);
}

可以向从 params.contentItemData 创建的 content 对象添加所需数据。Oracle 建议将 params.scsData 中的属性合并到此对象中,以便模板也可以利用它们。应将呈现的模板附加到向 render() 方法传递的父对象。