Files
KinginfoGateway/framework/Demo/ThingsGateway.Foundation.Demo.Rcl/Shared/BaseLayout.razor

42 lines
1.3 KiB
Plaintext
Raw Normal View History

2023-05-23 23:54:28 +08:00
@*
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
2023-07-16 17:48:22 +08:00
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
2023-05-23 23:54:28 +08:00
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
2023-07-16 17:48:22 +08:00
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
2023-05-23 23:54:28 +08:00
// QQ群605534569
//------------------------------------------------------------------------------
*@
2023-09-30 23:05:53 +08:00
@namespace ThingsGateway.Foundation.Demo
2023-05-23 23:54:28 +08:00
@inherits LayoutComponentBase
2023-09-30 23:05:53 +08:00
2023-03-04 18:41:11 +08:00
<CascadingValue Value="IsMobile" Name="IsMobile">
<MApp>
2023-05-22 18:40:50 +08:00
<MErrorHandler>
2023-03-04 18:41:11 +08:00
@Body
</MErrorHandler>
</MApp>
</CascadingValue>
2023-09-30 23:05:53 +08:00
@code {
public bool IsMobile { get; set; }
2023-03-04 18:41:11 +08:00
[Inject]
public MasaBlazor MasaBlazor { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();
2023-07-12 21:21:50 +08:00
MasaBlazor.BreakpointChanged += BreakpointOnOnUpdate;
2023-03-04 18:41:11 +08:00
}
2023-06-25 18:59:09 +08:00
private void BreakpointOnOnUpdate(object sender, BreakpointChangedEventArgs e)
2023-03-04 18:41:11 +08:00
{
2023-08-07 15:09:53 +08:00
IsMobile = MasaBlazor.Breakpoint.Mobile;
2023-06-25 18:59:09 +08:00
if (e.MobileChanged)
{
StateHasChanged();
}
2023-03-04 18:41:11 +08:00
}
}