小编Isa*_*ala的帖子

ReachJS 空白文本节点不能显示为 <tr> 的子节点。确保每行标签之间没有任何额外的空格

我收到警告:validateDOMNesting(...): 空白文本节点不能显示为 的子节点。确保源代码每行的标记之间没有任何额外的空格。当我尝试在 ReactJS 中使用 MaterialUI 实现表格时。错误说在< TableRow..周围的代码行中发现空格。 但我在错误行中找不到任何空格。

return (
  <>
    <TableRow
      key={this.props.data.id}
      className="simpleProductRow align-top">
      <TableCell className="simpleProductInfo simpleProductCell">
        <Typography variant="body2" component="p">
          <Typography
            variant="body2"
            component="label"
            style={inlineBlockStyle}
          >
            Info:{' '}
          </Typography>
          <Typography className="simpleProductName" component="span">
            {this.props.data.name}
          </Typography>
        </Typography>

        <Typography variant="body2" component="span">
          <Typography variant="body2" style={inlineBlockStyle}>
            Part #:{' '}
          </Typography>
          <Typography style={inlineBlockStyle}>
            {this.props.data.sku}
          </Typography>
          <Typography style={inlineBlockStyleSmall}>
            (Mfr #: {this.props.data.manufacturerPartNumber})
          </Typography>
        </Typography>
        <Typography variant="body2" component="p">
          <Typography
            variant="body2"
            component="label"
            style={inlineBlockStyle}
          >
            Ships:{' '}
          </Typography>
          <Typography style={inlineBlockStyle} component="span">
            {' '}
            {this.props.data.deliveryDate}
          </Typography>
        </Typography> …
Run Code Online (Sandbox Code Playgroud)

reactjs material-ui

7
推荐指数
1
解决办法
1万
查看次数

路由在角度 6 中无法正常工作

我正在开发一个包含三个组件的小型角度项目。那个项目我有一个名为 component.module 的子模块,我在该模块中添加了添加的路由,并且 component.module 包含到 App.module。

它编译时没有任何错误,但屏幕上没有任何显示(见下图)。

在此处输入图片说明

我的项目文件夹结构是这样的。

文件夹结构

组件/app-routing.module.ts

import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { RouterModule, Routes } from "@angular/router";

import { MainLayoutComponent } from "./main-layout/main-layout.component";
import { IntentListComponent, IntentCreateComponent } from "./intent";

const routes: Routes = [
  { path: "", redirectTo: "/home", pathMatch: "full" },
  {
    path: "home",
    component: MainLayoutComponent,
    children: [
      { path: "list", component: IntentListComponent },
      { path: "create", component: IntentCreateComponent }
    ]
  } 
];

@NgModule({
  imports: [CommonModule, …
Run Code Online (Sandbox Code Playgroud)

routing typescript angular

6
推荐指数
1
解决办法
2万
查看次数

Angular 7:对预检请求的响应未通过访问控制检查:请求中不存在“Access-Control-Allow-Origin”标头

我必须使用 CURD 操作实现一个角度应用程序。API 已经托管在 AWS 中,它与 Postman 一起工作得很好。

但我的角度应用程序得到

CORS 政策已阻止在“ https://acp56df5alc.execute-api.us-east-1.amazonaws.com/ams/getmember 处访问 XMLHttpRequest来自源“ http://localhost:4200 ”:响应预检请求未通过访问控制检查:请求的资源上不存在“Access-Control-Allow-Origin”标头。

我的代码如下,

http_GET(actionUrl: string): Observable<any> {
        const httpOptions = {
            headers: new HttpHeaders({
                'Content-Type': 'application/json',
                'Access-Control-Allow-Origin': '*',
                'Access-Control-Allow-Credentials': 'true',
                'Access-Control-Allow-Headers': 'Content-Type',
                'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE',
                'key': 'x-api-key',
                'value': 'NNctr6Tjrw9794gFXf3fi6zWBZ78j6Gv3UCb3y0x',

            })
        };
        return this.http.get<any>(this.baseUrl + actionUrl, httpOptions).pipe(
            (response => {
                return response;
            }));
    }
Run Code Online (Sandbox Code Playgroud)

我已经努力解决这个问题。但需要一些帮助

javascript amazon-web-services angular angular7

5
推荐指数
2
解决办法
2万
查看次数

.net核心依赖注入,带参数注入

它是 .NET Core 2.0 控制台应用程序,使用 DI 如何将参数传递给构造函数。

RabbitMQPersistentConnection 类需要在构造函数上传递参数

RabbitMQPersistentConnection(ILogger logger, IConnectionFactory connectionFactory, IEmailService emailService);

我的实例

var _emailService = sp.GetRequiredService();

当我将其初始化为服务时,它不会像这样工作

程序.cs

public static class Program
{
    public static async Task Main(string[] args)
    {
        // get App settings
        var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
        IConfigurationRoot configuration = builder.Build();           


        //Initilize Service Collection
        #region Initilize Service Collection
        var serviceProvider = new ServiceCollection()
              .AddLogging()
              .AddEntityFrameworkSqlServer().AddDbContext<EmailDBContext>(option => option.UseSqlServer(configuration.GetConnectionString("connection_string")))
              .AddSingleton<IEmailConfiguration>(configuration.GetSection("EmailConfiguration").Get<EmailConfiguration>())                    
              .AddScoped<ISMTPService, SMTPService>()
              .AddScoped<IEmailService, EmailService>()
              .BuildServiceProvider();
        #endregion

       .ConfigureServices((hostContext, services) =>
           {
               services.AddLogging();
               services.AddHostedService<LifetimeEventsHostedService>(); …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection console-application .net-core asp.net-core

1
推荐指数
1
解决办法
3898
查看次数

如何在 Elasticsearch 7 NEST 7 中设置“max_result_window”

默认情况下,elasticsearch 仅返回 10k 结果。但我需要转到超过 10k 结果的最后一页。

我做了一些工作,并通过设置“max_result_window”找到了一个解决方案:100000 我在 Kibana 中执行它,甚至超过 5000 页在此设置后工作正常。

PUT jm-stage-products/_settings
{ 
  "max_result_window" : 100000 
}
Run Code Online (Sandbox Code Playgroud)

现在,当我在源代码中创建索引时,我需要包含此设置。但我找不到方法来做到这一点。这是我的索引创建函数。我应该如何设置“max_result_window”:100000?

  public string InitIndexing()
        {
            var indexName = string.Format(_config.ElasticIndexName, _config.HostingEnvironment);

            //-----------------------------------------------------------
            if (!_client.Indices.Exists(indexName).Exists)
            {
                //----------------------------------------------
                var indexSettings = new IndexSettings
                {
                    NumberOfReplicas = 0, // If this is set to 1 or more, then the index becomes yellow.
                    NumberOfShards = 5,                  
                };
             
                var indexConfig = new IndexState
                {
                    Settings = indexSettings
                };
                var createIndexResponses = _client.Indices.Create(indexName, c => c
                                          .InitializeUsing(indexConfig) …
Run Code Online (Sandbox Code Playgroud)

elasticsearch nest .net-core

0
推荐指数
1
解决办法
4084
查看次数