【问题标题】:Blazor Server Custom Re-connect UI - Display Retry AttemptsBlazor 服务器自定义重新连接 UI - 显示重试尝试
【发布时间】:2022-12-21 20:38:28
【问题描述】:

我有一个 Blazor Server 应用程序,它在电路断开连接时使用自定义“重新连接”UI 元素。这是正常的。

但是,在这样做的过程中,我丢失了显示已进行了多少次尝试的“1 of 8”文本。

我查看了有关自定义 UI 的 Microsoft 文档:

https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-3.1#reflect-the-connection-state-in-the-ui

...但是没有提到显示尝试次数。

有没有人成功地在自定义 UI 中显示了尝试次数,请指点我正确的方向?

【问题讨论】:

    标签: c# blazor blazor-server-side


    【解决方案1】:

    在 blazor.server.js 中四处挖掘后,我发现了以下代码行:

      Ln.CurrentAttemptId = "components-reconnect-current-attempt";
    

    ...并添加了一个带有该 Id 的元素,如下所示:

                <span id="components-reconnect-current-attempt">Number of Attempts here...</span>
    

    ...并得到了我想要的结果!

    【讨论】:

      猜你喜欢
      • 2023-01-25
      • 2020-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-17
      • 2020-10-13
      • 2019-09-23
      相关资源
      最近更新 更多