问题描述
我使用的是 AEM 6.5
我的 html 文件是
<div
data-sly-test="${empty && wcmmode.edit}"
class="cq-placeholder"
data-emptytext="${component.title}"
></div>
<sly data-sly-test="${!empty}">
<section class="band full-bleed">
....
</section>
</sly>
<div class="widget-hero cq-Editable-dom">
....
</div>
如何在 .show-image
时在装饰标签上切换类 data-sly-test="${!empty}"
,以便它可以像
<div class="widget-hero show-image cq-Editable-dom">
....
</div>
我试过了:
- 删除装饰标签
- 在这篇文章中回答 #2:https://www.py4u.net/discuss/312993
解决方法
您无法从内部组件渲染中控制装饰标签类。你可以:
- 从调用者组件(parsys/responsivegrid/container)控制它,但这会在它们之间产生很强的依赖
- 将所需的类放在中间标签上:装饰 -> 包装器 -> 标记