首页 > 解决方案 > 使用广播组切换 LWC 中的内容?

问题描述

我有这个单选组,如果我选择顶部选项,则只显示前两行,如果我选择底部选项,则只显示最后一行。如何在 LWC 中创建这种动态的选项卡选择?

标签: salesforcesalesforce-lightninglwc

解决方案


您正在寻找的内容记录在这里:https ://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_conditional

这看起来像这样:

<template if:true={topIsSelected}>
   <!-- first top two rows -->
</template>
<template if:true={bottomIsSelected}>
   <!-- last row -->
</template>

推荐阅读