blazor - Blazor 自定义重新加载/连接丢失文本
问题描述
我在 Blazor dotnet core 3.1 中编写应用程序,并希望在重新加载/丢失与服务器的连接时自定义默认文本以使用动画 svg 本地化文本,让用户知道它正在重新连接。
问题是我当前的版本没有隐藏文本,不知道如何或在哪里让它可见/不可见。
使用此链接:
https://docs.microsoft.com/de-de/aspnet/core/blazor/hosting-models?view=aspnetcore-3.1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="components-reconnect-modal" class="my-reconnect-modal components-reconnect-hide">
<div class="show">
<p>
This is the message when attempting to connect to server
</p>
</div>
<div class="failed">
<p>
This is the custom message when failing
</p>
</div>
<div class="refused">
<p>
This is the custom message when refused
</p>
</div>
</div>
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
我的风格:
.components-reconnect-hide > div
{
display: none;
}
.components-reconnect-show > div
{
display: none;
}
.components-reconnect-show > .show
{
display: block;
}
.components-reconnect-failed > div
{
display: none;
}
.components-reconnect-failed > .failed
{
display: block;
}
.components-reconnect-refused >div
{
display: none;
}
.components-reconnect-refused > .refused
{
display: block;
}
知道如何正确完成吗?
谢谢!
解决方案
推荐阅读
- java - 推荐“setLayout(null)”并绘制矩形
- javascript - Sequelize - 将模型映射到字段
- php - Laravel 7 Eloquent:模型上的方法 refresh() 忽略默认(嵌套)急切加载
- python - 根据重复的第一个元素从列表列表中删除重复项
- mysql - 更简化的查询?
- javascript - Node.js POST 请求有数据,但在 mongoDB 中我只看到 id 而不是数据
- vb.net - 如何过滤仅匹配指定记录的记录
- c# - ASP.NET Web 应用程序无法在 Visual Studio 2019 中发布
- sql - 有没有办法根据选择的过滤器 SQL 选择 value = all 或 none 的所有记录?
- java - 原子变量上的可变关键字