You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在AEM中调整Teaser组件的对话框Tab选项排序及显隐配置

AEM Teaser组件对话框Tab配置解决方案

问题1:未在XML中声明的Tab仍展示

原因:自定义AEM组件默认会继承父级核心组件的对话框节点,未主动声明隐藏的节点会自动合并到自定义组件的对话框配置中。
解决方案:
在ui.apps/.../components/teaser/_cq_dialog/.content.xml的tabs根节点新增sling:hideChildren属性,填入需要隐藏的Tab对应的节点名即可,示例配置:

<tabs
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/tabs"
    sling:hideChildren="[actions]">
    <!-- 你自定义的Image、Metadata、Text三个Tab的配置 -->
</tabs>

注:官方核心Teaser组件的「Link & Actions」Tab对应节点名默认为actions,如果你的父组件自定义过节点名,可直接去父组件的dialog配置中确认节点名即可。

如果需要保留该Tab仅调整排序,通过sling:orderBefore属性控制节点渲染顺序即可:
给每个自定义Tab节点添加sling:orderBefore属性,值为排在当前节点之后的下一个节点名,示例配置:

<tabs
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/tabs">
    <image
        jcr:primaryType="nt:unstructured"
        jcr:title="Image"
        sling:orderBefore="metadata"
        <!-- 剩余Image Tab的配置项 -->
    />
    <metadata
        jcr:primaryType="nt:unstructured"
        jcr:title="Metadata"
        sling:orderBefore="text"
        <!-- 剩余Metadata Tab的配置项 -->
    />
    <text
        jcr:primaryType="nt:unstructured"
        jcr:title="Text"
        sling:orderBefore="actions"
        <!-- 剩余Text Tab的配置项 -->
    />
    <actions
        jcr:primaryType="nt:unstructured"
        jcr:title="Link & Actions"
        <!-- 剩余Link & Actions Tab的配置项,无需配置orderBefore,默认排在最后 -->
    />
</tabs>

配置完成后重新部署代码到AEM实例,刷新编辑器页面即可生效。


内容的提问来源于stack exchange,提问作者Augusto

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 19:15:05