【发布时间】:2019-04-03 19:03:51
【问题描述】:
我想找到一种将 HTML 插入 <sly data-sly-resource> 标记内的方法,并能够进入我从资源属性中检索的组件。
比较一下,类似于 Vue 的 slots 和 React 的 { this.props.children }。
例子:
父组件
<sly data-sly-resource="${'example' @ resourceType='path/to/component/structure/example'}">
<h1>Hello World</h1>
</sly>
示例组件
<div id="example-component">
${ variable.getChildrenHTMLCall() } // Does something like this exist?
</div>
输出
<div id="example-component">
<h1>Hello World</h1>
</div>
【问题讨论】:
-
此功能不存在。您可以使 similar 功能与 data-sly-template 一起使用,但您必须将 html 字符串作为参数而不是作为可能不需要或不可维护的子元素传递。
-
也许添加您的评论作为答案,@AhmedMusallam?
标签: aem