小编Lui*_*cia的帖子

类型错误:无法读取反应组件中未定义的属性“getFieldDecorator”

我有这个错误:

> TypeError: Cannot read property 'getFieldDecorator' of undefined
> _class.render src/containers/RegisterTenant/register.js:81   78 |     this.setState({ 'selectedFiles': files });   79 | }   80 |  
> > 81 |   render(){   82 |     const { data } = this.state;   83 |     const { rowStyle, colStyle, gutter } = basicStyle;   84 |     const {
> getFieldDecorator } = this.props.form; View compiled ? 18 stack frames
> were collapsed. AsyncFunc._callee$ src/helpers/AsyncFunc.js:26   23 |
> const { default: Component } = await importComponent();   24 |
> …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs antd

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

属性“ hot”在类型“ NodeModule”上不存在。ts(2339)

我已经购买了带有以下几行的react模板,但是我不清楚它的目的是什么,该模板在JS中使用,我想将其更改为Typescript

模板中存在以下几行

 if (module.hot) {
    module.hot.accept('./dashApp.js', () => {
      const NextApp = require('./dashApp').default;
      ReactDOM.render(<NextApp />, document.getElementById('root'));
    });
  }
Run Code Online (Sandbox Code Playgroud)

但是,当重命名为.TS时,出现此错误:

Property 'hot' does not exist on type 'NodeModule'.ts(2339)
Run Code Online (Sandbox Code Playgroud)

该代码真正的作用是什么?用简单的英语

reactjs webpack

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

'ConfigurationBuilder'不包含'AddJsonFile'的定义

我有以下错误:

Program.cs(15,72):错误CS1061:'ConfigurationBuilder'不包含'AddJsonFile'的定义,并且找不到可访问的扩展方法'AddJsonFile'接受类型为“ ConfigurationBuilder”的第一个参数(您是否缺少使用指令或汇编

该项目是一个使用Azure Search SDK的dotnet核心应用程序,控制台应用程序

错误行如下:

using System;
using System.Linq;
using System.Threading;
using Microsoft.Azure.Search;
using Microsoft.Azure.Search.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Spatial;

namespace DemoSearchIndexer
{
    class Program
    {
        static void Main(string[] args)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
            IConfigurationRoot configuration = builder.Build();
Run Code Online (Sandbox Code Playgroud)

c# .net-core

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

避免非只读静态字段-不变性NDepend

我正在使用NDepend进行代码分析,并收到以下警告:

https://www.ndepend.com/default-rules/NDepend-Rules-Explorer.html?ruleid=ND1901#

此规则警告未声明为只读的静态字段。

在面向对象编程中,实例字段是用于保存可修改状态的自然工件。这种可变的静态字段会在运行时引起对预期状态的混淆,并损害代码的可测试性,因为对于每个测试都重复使用相同的可变状态。

我的代码如下:

using Cosmonaut;
using Microsoft.Azure.Documents.Client;
using System.Configuration;
using LuloWebApi.Entities;


namespace LuloWebApi.Components
{
    /// <summary>
    /// Main class that encapsulates the creation of instances to connecto to Cosmos DB
    /// </summary>
    public sealed class CosmosStoreHolder
    {
        /// <summary>
        /// Property to be initiated only once in the constructor (singleton)
        /// </summary>
        private static CosmosStoreHolder instance = null;

        /// <summary>
        /// To block multiple instance creation
        /// </summary>
        private static readonly object padlock = new object();

        /// …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net asp.net-mvc asp.net-web-api

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

泛型问题排序

他们在采访中告诉我

将代码写在括号中以排序列表.他们说订单,但你不知道类型是否会intdecimal.

他们还告诉我不要使用类似的框架方法 .sort

所以我不知道我该怎么做?我需要做好准备,下次有人问我这个问题.

可能的输入:7,3,8,6,1
或:6.9,4.5,2.3,6.1,9.9

namespace InterViewPreparation1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnSort_Click(object sender, EventArgs e)
        {
            List<int> list= new List<int>();
            list.Add(int.Parse(i1.Text));
            list.Add(int.Parse(i2.Text));
            list.Add(int.Parse(i3.Text));
            list.Add(int.Parse(i4.Text));
            list.Add(int.Parse(i5.Text));
            Sort(list);
        }


        private void Sort<T>(List<T> list)
        {
            bool madeChanges;
            int itemCount = list.Count;
            do
            {
                madeChanges = false;
                itemCount--;
                for (int i = 0; i < itemCount; i++)
                {
                    int result = Comparer<T>.Default.Compare(list[i], list[i + 1]);

                    if (result …
Run Code Online (Sandbox Code Playgroud)

.net c# generics

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

复杂的javascript代码,我可以删除吗?或它做什么?

在我的网站www.theprinterdepo.com,你可以查看页面源代码,我有一个代码,我的seo咨询建议我移动到外部文件.

它是一个建立在magento上的电子商务网站.它是一个免费的开源工具,所以我没有开发它,我只是安装它.

我需要知道代码的作用.

window.HDUSeed='c7025284683262a8eb81056c48968d74';
window.HDUSeedIntId = setInterval(function(){
    if (document.observe) {
        document.observe('dom:loaded', function(){
            for (var i = 0; i < document.forms.length; i++) {
                if (document.forms[i].getAttribute('action') &&  document.forms[i].getAttribute('action').match('contacts/index/post')) {
                    var el = document.createElement('input');
                    el.type = ('hidden');
                    el.name = 'hdu_seed';
                    el.value = window.HDUSeed;
                    document.forms[i].appendChild(el);
                }
            }
        });
        clearInterval(window.HDUSeedIntId)
    }
}, 100);
Run Code Online (Sandbox Code Playgroud)

javascript magento

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

您的SQL语法有错误; 查看与MySQL对应的手册

我试图运行一个mysql查询来查找文本的所有出现.我有语法错误,但不知道在哪里或如何解决它

我使用sqlyog来执行这个脚本

DECLARE @url VARCHAR(255)

SET @url = '1720'

SELECT 'select * from ' + RTRIM(tbl.name) + ' where ' + 
          RTRIM(col.name) + ' like %' + RTRIM(@url) + '%'
FROM sysobjects tbl
INNER JOIN syscolumns col ON tbl.id = col.id 
AND col.xtype IN (167, 175, 231, 239) -- (n)char and (n)varchar, there may be others to include
AND col.length > 30 -- arbitrary min length into which you might store a URL
WHERE tbl.type = 'U'    -- user defined …
Run Code Online (Sandbox Code Playgroud)

mysql mysql-error-1064

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

当前用户没有足够的权限来执行此操作.在sharepoint中添加Termset

我试图将一个字段绑定到一个termset,如果termset不存在,我想通过代码创建它.但是,即使代码以提升的权限运行,我也会收到以下异常.

当前用户没有足够的权限来执行此操作.

public static void BindTaxonomyField(string taxonomyFieldId, string taxonomyNoteFieldId, string termSetName, string termGroup, SPWeb web)
        {
            try
            {
                if (web != null)
                {
                    // get the taxonomyfield from the sitecollection
                    var field = web.Fields[new Guid(taxonomyFieldId)] as TaxonomyField;
                    if (field != null)
                    {
                        // attach the note field
                        field.TextField = new Guid(taxonomyNoteFieldId);

                        // set up the field for my termstore
                        var session = new TaxonomySession(web.Site);

                        if (session.TermStores.Count > 0)
                        {
                            // get termstore values
                            TermStore ts = session.TermStores[0];
                            Group group = …
Run Code Online (Sandbox Code Playgroud)

c# sharepoint sharepoint-2010 sharepoint-2013

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

asp.net mvc上的Page.Request?

我试图执行此代码,除了page_load

protected void Page_Load(object sender, EventArgs e) 
{ 
    var contextToken = TokenHelper.GetContextTokenFromRequest(Page.Request); 
Run Code Online (Sandbox Code Playgroud)

在控制器中

var contextToken = TokenHelper.GetContextTokenFromRequest(Page.Request);
Run Code Online (Sandbox Code Playgroud)

但是我得到了这个错误

错误1非静态字段,方法或属性'System.Web.UI.Page.Request.get'需要对象引用

如何在MVC中获取当前页面请求?

更新1:

我改为:

 var contextToken = TokenHelper.GetContextTokenFromRequest(HttpContext.Current.Request);
Run Code Online (Sandbox Code Playgroud)

现在我得到了:

错误2'System.Web.HttpContextBase'不包含'Current'的定义,并且没有扩展方法'Current'可以找到接受类型'System.Web.HttpContextBase'的第一个参数(你是否缺少using指令或者装配参考?)

我需要什么组件?

这些是我的用途

using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc

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

403捆绑CSS时出错

我的单页应用上有以下错误:

http://screencast.com/t/sEYhyowXTqxR

因此页面看起来很丑陋.

我的bundleconfig.cs我没有修改它:

 public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.IgnoreList.Clear();
            AddDefaultIgnorePatterns(bundles.IgnoreList);

            bundles.Add(
                new ScriptBundle("~/scripts/modernizr")
                    .Include("~/scripts/modernizr-{version}.js"));

            bundles.Add(
              new ScriptBundle("~/scripts/vendor")
                .Include("~/scripts/jquery-{version}.min.js")
                .Include("~/scripts/bootstrap.min.js")
              );

            bundles.Add(
             new StyleBundle("~/Content/css")
                .Include("~/Content/ie10mobile.css") // Must be first. IE10 mobile viewport fix
                .Include("~/Content/bootstrap.min.css")
                .Include("~/Content/bootstrap-responsive.min.css")
                .Include("~/Content/font-awesome.min.css")
                .Include("~/Content/styles.css")
             );
        }
Run Code Online (Sandbox Code Playgroud)

和我的VS :(一切看起来都很好)

http://screencast.com/t/TQFAPCEsV

更新:

这发生在我在web.config上将调试模式更改为false时,当调试模式为true时,网页呈现正常并且网络选项卡上没有显示错误

asp.net asp.net-mvc bundling-and-minification

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