草庐IT

properties

全部标签

javascript - 测试套件无法运行 TypeError : Cannot read property 'default' of undefined

我正在尝试在我的react-native项目上设置Jest,但它与bugsnag-react-native配合得不好.在我当前的测试配置中,我看到了与bugsnag的leaveBreadcrumb函数相关的错误,如下所示:FAILapp/__tests__/NetworkReducer.test.js●TestsuitefailedtorunTypeError:Cannotreadproperty'default'ofundefinedatObject.(app/__tests__/NetworkReducer.test.js:10:20)atGenerator.next()atPro

javascript - 像数组一样访问json对象中的元素

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:Ihaveanesteddatastructure/JSON,howcanIaccessaspecificvalue?我有一个json对象,如下所示:[["Blankaholm","Gamleby"],["2012-10-23","2012-10-22"],["Blankaholm.Undernattenhardetvaritinbrott","E22imedGamleby.Singelolycka.Enbilisthar.],["57.586174","16.521841"],["57.893162","16

javascript:class.property 与 class.prototype.property 模拟静态属性

我一直在尝试在javascript中模拟静态属性。在几个地方已经提到,class.prototype.property在所有继承自该类的对象中都是静态的。但我的POC另有说法。请看一下:使用Class.prototype.property//EmployeeclassfunctionEmployee(){this.getCount=function(){returnthis.count;};this.count+=1;}Employee.prototype.count=3;varemp=[],i;for(i=0;i我的问题#1:如果这是静态的,那么count的值不应该是4、5、6等,因

javascript - Internet Explorer 11 : Object doesn't support property or method 'isInteger'

我在InternetExplorer控制台中遇到此错误“对象不支持属性或方法‘isInteger’”,我该如何解决?代码:functionverificaNota(nota){if(nota.length>0){vararr=[];if(nota.indexOf(".")!=-1){returnferificareArrayNote(nota.split('.'));}elseif(nota.indexOf(",")!=-1){ferificareArrayNote(nota.split(','));}elseif(nota.length0){returntrue;}else{retu

javascript - 无法解析数据表 SCRIPT5007 : Unable to set property '_DT_CellIndex' of undefined or null reference

我无法解决以下数据表错误:SCRIPT5007:Unabletosetproperty'_DT_CellIndex'ofundefinedornullreference我试图在整个互联网上寻找并找到了this成为最好的解决方案。但我仍然无法解决这个问题。我在这里错过了什么吗?我是JavaScript的新手。 最佳答案 基本上这个问题是因为th到td的未匹配计数而出现的。确保与td匹配的次数。希望这对您有所帮助。 关于javascript-无法解析数据表SCRIPT5007:Unablet

javascript - JqueryUI 日期选择器 : Uncaught TypeError: Cannot read property 'settings' of undefined?

我正在开发一个asp.netMVC4项目,我在其中使用了大量的JqueryUIdatepicker。对于我的一个日期选择器,当我尝试点击日期选择器图像时出现一些错误,例如,UncaughtTypeError:Cannotreadproperty'settings'ofundefinedjquery-ui-1.10.3.min.js:9HTMLJavascriptvarcurrentDate=newDate();$("#tsDte").datepicker({dateFormat:'yy-mm-dd',maxDate:0,changeYear:true}).attr('readonly'

javascript - 在 React.js 中将 key 传递给 child

我正在浏览一个关于tutsplus的React教程,它有点旧,而且代码不能像最初编写的那样工作。实际上,我完全同意这一点,因为它迫使我更加独立地学习,但是我花了一段时间来解决一个我无法弄清楚的错误。该错误包括无法传递对象键,这会阻止我的程序更新正确对象的状态。如果您想运行此代码并查看它的运行情况,首先是存储库:https://github.com/camerow/react-voteit我有一个看起来像这样的子组件:varFeedItem=React.createClass({vote:function(newCount){console.log("Votingon:",this.pr

javascript对象访问性能

在Javascript中,当您获取对象的属性时,获取整个对象与仅获取该对象的属性相比是否会降低性能?另外请记住,我不是在谈论DOM访问,它们是纯粹的简单Javascript对象。例如:以下代码之间是否存在某种性能差异:假设更快但不确定:varlength=some.object[key].length;if(length===condition){//Dosomethingthatdoesntneedanythinginsideofsome.object[key]}else{varobject=some.object[key];//Dosomethingthatrequiresstuf

javascript - 根据同一类中的其他属性计算的 Javascript 类的属性

这可能是我遗漏的一些非常愚蠢的东西,但是我如何让一个类的属性根据同一类中其他属性的值自动重新计算?例如functionTest(){this.prop1=1;this.prop2=2;this.prop3=this.prop1+this.prop2;}tester=newTest();alert(tester.prop1);//expect1alert(tester.prop2);//expect2alert(tester.prop3);//expect3tester.prop1+=1;alert(tester.prop1);//expect2alert(tester.prop2);/

javascript - 未捕获的类型错误 : cannot read property 'replace' of undefined In Grid

我是KendoGrid和KendoUI的新手。我的问题是如何解决此错误UncaughtTypeError:Cannotreadproperty'replace'ofundefined这是我在KendoGrid上的代码$("#Grid").kendoGrid({scrollable:false,sortable:true,pageable:{refresh:true,pageSizes:true},dataSource:{transport:{read:{url:'/Info/InfoList?search='+search,dataType:"json",type:"POST"}},p