Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 文本框的Blazor@onkeypress不';你不在IE工作吗?_C#_Razor_Blazor_Blazor Server Side - Fatal编程技术网

C# 文本框的Blazor@onkeypress不';你不在IE工作吗?

C# 文本框的Blazor@onkeypress不';你不在IE工作吗?,c#,razor,blazor,blazor-server-side,C#,Razor,Blazor,Blazor Server Side,我正在创建一个服务器端blazor应用程序,并拥有以下razor文件 @page "/test" @using BlazorApp2.Data @inject ViewModels.TestViewModel VM <div> Search: <input id="search" type="text" @bind="VM.Search" @onkeypress="@VM.SearchChanged" /> <span>@VM.Sea

我正在创建一个服务器端blazor应用程序,并拥有以下razor文件

@page "/test"
@using BlazorApp2.Data
@inject ViewModels.TestViewModel VM

<div>
    Search:
    <input id="search" type="text" @bind="VM.Search" @onkeypress="@VM.SearchChanged" />
    <span>@VM.Search</span>
</div>

在IE中,在文本框中键入“搜索”不会达到
SearchChanged()
中设置的断点?它在铬合金中工作

我认为您可能会错过在Startup.ConfigureServices中注册TestViewModel

您可以访问此链接:以了解更多信息

如果您希望Blazor在IE11上运行,请添加Polyfills。访问此链接:了解更多信息

您可以在此处下载Polyfills:

以下是您的问题的示例。希望能帮上忙,我的朋友:))

1) 模型

2) 在创业班

public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton<WeatherForecastService>();
            services.AddSingleton<Models.TestViewModel>();
        }
public void配置服务(IServiceCollection服务)
{
services.AddRazorPages();
AddServerSideBlazor();
services.AddSingleton();
services.AddSingleton();
}
3) 看法

@page”/testview
@InjectModels.TestViewModel虚拟机
试验叶片
搜索:
@虚拟机搜索
4) 在主机视图中

@page "/"
@namespace BlazorApp.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>BlazorApp</title>
    <base href="~/" />
    <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
    <link href="css/site.css" rel="stylesheet" />
</head>
<body>
    <app>
        @(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
    </app>

    <script src="~/scripts/blazor.polyfill.min.js"></script>
    <script src="_framework/blazor.server.js"></script>
</body>
</html>
@page/“
@名称空间BlazorApp.Pages
@addTagHelper*,Microsoft.AspNetCore.Mvc.TagHelpers
布拉佐拉普
@(等待Html.RenderComponentAsync(RenderMode.ServerPrerendered))

我认为您可能会错过在Startup.ConfigureServices中注册TestViewModel

您可以访问此链接:以了解更多信息

如果您希望Blazor在IE11上运行,请添加Polyfills。访问此链接:了解更多信息

您可以在此处下载Polyfills:

以下是您的问题的示例。希望能帮上忙,我的朋友:))

1) 模型

2) 在创业班

public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton<WeatherForecastService>();
            services.AddSingleton<Models.TestViewModel>();
        }
public void配置服务(IServiceCollection服务)
{
services.AddRazorPages();
AddServerSideBlazor();
services.AddSingleton();
services.AddSingleton();
}
3) 看法

@page”/testview
@InjectModels.TestViewModel虚拟机
试验叶片
搜索:
@虚拟机搜索
4) 在主机视图中

@page "/"
@namespace BlazorApp.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>BlazorApp</title>
    <base href="~/" />
    <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
    <link href="css/site.css" rel="stylesheet" />
</head>
<body>
    <app>
        @(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
    </app>

    <script src="~/scripts/blazor.polyfill.min.js"></script>
    <script src="_framework/blazor.server.js"></script>
</body>
</html>
@page/“
@名称空间BlazorApp.Pages
@addTagHelper*,Microsoft.AspNetCore.Mvc.TagHelpers
布拉佐拉普
@(等待Html.RenderComponentAsync(RenderMode.ServerPrerendered))

我对此做了一个分析,它工作得很好。结果表明,它不仅在IE中工作。服务器端Blazor可以使用polyfills在IE11中工作。阅读更多我对此做了一个详细介绍,它工作得很好。结果表明,它不仅在IE中工作。服务器端Blazor可以使用polyfills在IE11中工作。阅读更多
@injectmodels.TestViewModel VM
将在运行时破坏组件如果他忘记注册它,组件将不会呈现。所以这不可能。@Tewr,是的,虚拟机是重新设置的。事实证明,它不在IE中运行。它在Chrome中工作。@ca9163d9:很抱歉,我的朋友反应太晚了。根据Tewr的建议,您需要添加polyfill以在IE(11)上运行Blazor。我更新了我的解决方案。请检查它。
@injectmodels.TestViewModel VM
将在运行时破坏该组件。如果他忘记注册它,该组件将不会呈现。所以这不可能。@Tewr,是的,虚拟机是重新设置的。事实证明,它不在IE中运行。它在Chrome中工作。@ca9163d9:很抱歉,我的朋友反应太晚了。根据Tewr的建议,您需要添加polyfill以在IE(11)上运行Blazor。我更新了我的解决方案。请检查一下。
@page "/"
@namespace BlazorApp.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>BlazorApp</title>
    <base href="~/" />
    <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
    <link href="css/site.css" rel="stylesheet" />
</head>
<body>
    <app>
        @(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
    </app>

    <script src="~/scripts/blazor.polyfill.min.js"></script>
    <script src="_framework/blazor.server.js"></script>
</body>
</html>