我已經用字體很棒的字串填充了 List,例如:
private static readonly List<string> Icons = new(){
"<i class=\"fas fa-users\"></i>",
"<i class=\"fas fa-user-tag\"></i>",
"<i class=\"fas fa-sitemap\"></i>",
"<i class=\"fas fa-cubes\"></i>",
"<i class=\"fas fa-shield-alt\"></i>"
};
在視圖中我有一個下拉串列:
<select asp-for="Icon" class="form-control" asp-items="ViewBag.Icons"></select>
然后當我在 SelectList 中顯示它們時,我得到:

我想將它們呈現為 html 并顯示圖示,而不是字串。是否可以?也許使用 JS 或 jQuery?
uj5u.com熱心網友回復:
您不能按照這個問題<i>在<option>元素中呈現圖示元素:
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/321737.html
標籤:C# 网站 。网 asp.net-mvc 剃刀
