mirror of
https://gitee.com/blazorcomponent/MASA.Blazor.git
synced 2025-12-06 10:19:23 +08:00
* ♻ refactor: migrate all mobile components to a separate project
* remove unused files
* update
* update locale
* 🐛 fix: updating the logic of fetching latest release version
* update cicd
* update
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
@using Masa.Blazor.Presets
|
|
|
|
<div class="text-center">
|
|
<MSelect @bind-Value="_precision"
|
|
Label="Precision"
|
|
Items="@Items"
|
|
ItemText="i => i.ToString()"
|
|
ItemValue="i => i"
|
|
Class="d-inline-block"
|
|
Style="max-width: 180px">
|
|
</MSelect>
|
|
|
|
<PMobileTimePicker @bind-Value="_time" Precision="_precision" @key="_precision">
|
|
<ActivatorContent>
|
|
<MButton Color="primary" Class="text-capitalize" Text @attributes="@context.Attrs">
|
|
@(ComputedTime.ToString("HH:mm:ss"))
|
|
</MButton>
|
|
</ActivatorContent>
|
|
</PMobileTimePicker>
|
|
</div>
|
|
|
|
@code {
|
|
|
|
private TimeOnly _time;
|
|
private TimePrecision _precision = TimePrecision.Second;
|
|
|
|
private readonly static List<TimePrecision> Items = new()
|
|
{
|
|
TimePrecision.Hour,
|
|
TimePrecision.Minute,
|
|
TimePrecision.Second
|
|
};
|
|
|
|
private TimeOnly ComputedTime => _precision switch{
|
|
TimePrecision.Hour => new TimeOnly(_time.Hour, 0, 0),
|
|
TimePrecision.Minute => new TimeOnly(_time.Hour, _time.Minute, 0),
|
|
_ => _time
|
|
};
|
|
|
|
}
|