mirror of
https://gitee.com/blazorcomponent/MASA.Blazor.git
synced 2025-12-06 10:19:23 +08:00
🆕 feat(Combobox): supports select custom chip when using SelectionContent (#2445)
* 🆕 feat(Combobox): supports select custom chip when using SelectionContent
* update
This commit is contained in:
@@ -1 +1,35 @@
|
||||
TODO
|
||||
<MRow>
|
||||
<MCol Cols="12">
|
||||
<MCombobox @bind-Value="_chips"
|
||||
Items="_items"
|
||||
ItemText="u => u"
|
||||
ItemValue="u => u"
|
||||
Chips
|
||||
Clearable
|
||||
Label="Your favorite hobbies"
|
||||
Multiple
|
||||
PrependIcon="mdi-filter-variant"
|
||||
Solo>
|
||||
<SelectionContent>
|
||||
<MChip Close
|
||||
IsActive="@context.Selected"
|
||||
OnClick="@context.Select"
|
||||
OnCloseClick="() => Remove(context.Text)">
|
||||
<strong>@context.Text</strong>
|
||||
<span>(interest)</span>
|
||||
</MChip>
|
||||
</SelectionContent>
|
||||
</MCombobox>
|
||||
</MCol>
|
||||
</MRow>
|
||||
|
||||
@code {
|
||||
private List<string> _chips = ["Programming", "Playing video games", "Watching movies", "Sleeping"];
|
||||
private List<string> _items = ["Streaming", "Eating"];
|
||||
|
||||
private void Remove(string item)
|
||||
{
|
||||
_chips.Remove(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
Chips>
|
||||
<SelectionContent>
|
||||
<MChip IsActive="@context.Selected"
|
||||
OnClick="@context.Select"
|
||||
Disabled="@context.Disabled">
|
||||
<MAvatar Class="primary"
|
||||
Left>
|
||||
|
||||
Reference in New Issue
Block a user