我的组件中有一个嵌入的图像组件,只有在创建图像组件时,我才需要显示图像,
组件代码:
<div class="col-md-4">
<sly data-sly-resource="${'image' @ resourceType='test/components/content/image'}"></sly>
</div>因此,我需要检查是否编写了嵌入式图像组件的资源。
我知道我们可以在Java中做到这一点,但是如何在Sightly中这样做呢?
发布于 2019-01-29 10:49:25
这是可行的,使用${resource'image/jcr:primaryType'},
这里的图像是子组件
<sly data-sly-test="${resource['image/jcr:primaryType']}">
<div class="col-xs-5 col-md-4">
<sly data-sly-resource="${'image' @ resourceType='test/components/content/image'}"></sly>
</div>
</sly>https://stackoverflow.com/questions/54419352
复制相似问题