MatSelectValue 的不同 ItemTemplate

问题描述

我正在使用 MatSelectValue 我想,当我点击下拉菜单时,使用一个显示选择描述的 ItemTemplate

<MatSelectValue TItem="ServiceLevelAgreementModel" TValue="string" @bind-Value="Instrument.SLA.SLA_Id" Items="@SLAOptions" ValueSelector="@(i=>i.Id)">
    <ItemTemplate Context="SLAOption">
        <span>@SLAOption?.Id</span><br />
        <span>@SLAOption?.Description</span>
    </ItemTemplate>
</MatSelectValue>

但我不希望描述显示在下拉菜单中 我实际上希望选择只会显示 ValueSelector="@(i=>i.Id)" 中的值,但是考虑一下我可以理解为什么这也会有问题......

知道如何实现一个下拉菜单,我可以在其中为展开的下拉项目指定一个模板,并为所选项目指定另一个模板吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)