我有一个关于使用 Sightly 访问组件的子节点的问题。我有一个模板,它使用 data-sly-resource 引入基本图像组件,就像这样。
<div class="${wcmmode.edit ? 'image-edit image' : 'image'}" data-sly-resource="${ 'heroImage' @ resourceType='/libs/foundation/components/image', appendPath='image', selectors='fileReference' }"> </div>
我想做的是根据该图像组件是否实际具有图像集来更改 css 类。为此,我的计划是访问图像组件节点并读取其文件引用。类似的东西
<h1>${ properties["heroImage"] }</h1>
不幸的是,这不起作用。我的问题是如何从我的模板访问 heroImage 资源的 fileReference,将其视为子节点。
谢谢,哈利