草庐IT

is_pointed_to

全部标签

javascript - react 代码抛出 “TypeError: this.props.data.map is not a function”

我刚开始用React编码,我习惯用CoffeeScript编码。我试着沿着tutorialpresentedintheReactdocs编码并为状态更新做了类似的事情。但是,我收到TypeError:this.props.data.mapisnotafunction。我有点迷茫,想知道我哪里错了。有人可以指导我并告诉我哪里出错了吗?这是我的代码:(function(){varStatus,StatusBox,StatusForm,StatusList,button,div,h4,textarea,_ref;_ref=React.DOM,div=_ref.div,textarea=_re

javascript - 如何使 "undefined is not a function"错误更有用?

考虑这段JavaScript代码:varx=newdate()//"ReferenceError:dateisnotdefined"-usefulerror,hintsatatypo('D'ate)varx=newMyClass.foo()//"TypeError:undefinedisnotafunction"-baderror,nohintitmightbe'F'oo错误本身是正确的,因为MyClass没有foo方法,所以MyClass.foo确实返回了undefined,new不喜欢这样。问题是这根本没有暗示用户可能拼错了方法名称。现实生活中的例子:newMeteor.colle

javascript - 火狐插件 : How to override native js function

我正在尝试使用pageMod在页面加载时运行脚本:但我看不到它的效果vardata=require("sdk/self").data;varattachTo=require("sdk/content/mod").attachTo;varpageMod=require("sdk/page-mod");pageMod.PageMod({include:"*",contentScriptWhen:"start",allow:true,attachTo:["existing","top"],contentScriptFile:[data.url("jquery-2.1.1.min.js"),d

javascript - "Access is Denied"在同一域的 IE9 中的 contentDocument

这个问题在这里已经有了答案:"Accessisdenied"JavaScripterrorwhentryingtoaccessthedocumentobjectofaprogrammatically-created(IE-only)(12个答案)关闭6年前。简短/通用版本:我正在开发一个应用程序(不幸的是,由于其他原因),将每个页面顶部的document.domain设置为“真实”域的子字符串:对于像sub.app.local,document.domain="app.local".我还在动态创建一个iframe并将其添加到页面。iframe加载与父页面位于同一服务器上的文件。稍后,一

javascript - 如何转换 10 :09:00 GMT+0000 to IST in javascript?

我正在开发网络应用程序,因为我们正在使用CK编辑器日历。我在其中执行以下代码以获取Date&Time..代码:varstrDate=newDate(event.start);varendDate=newDate(event.end);vartitle='Event:'+event.title+'From:'+event.start.toLocaleString()+'To:'+event.end.toLocaleString()+'By:';输出:FriFeb13201510:37:00GMT+0000To:FriFeb13201510:37:00GMT+0000预期输出:在上面的输出

javascript - 期望失败 : "Expected [ ] to be empty array."

这是失败的测试:describe("Checkingerrors",function(){varscope={};beforeEach(function(){browser.get("/#endpoint");browser.waitForAngular();scope.page=newMyPage();});it("shouldnotshowanyerrors",function(){expect(scope.page.errors).toBeEmptyArray();});});其中MyPage是一个页面对象:varMyPage=function(){this.errors=ele

javascript - 为什么我会收到 ReferrenceError : BinaryFile is not Defined

我关注thisanswer中的结果完全正确,但我收到以下错误:ReferenceError:BinaryFileisnotdefined这是使用它的代码:fr.onloadend=function(){console.log(this);exif=EXIF.readFromBinaryFile(newBinaryFile(this.result));}console.log显示那里有数据,我只是不明白我收到的这个错误。感谢您的帮助。 最佳答案 我用了下面的,效果很好EXIF.getData(img,function(){orient

javascript - react /归零 : mapStateToProps not actually mapping state to props

我在项目中使用React和Redux,但在实现启用/禁用按钮的功能时遇到问题。我已经能够:触发方法让该方法触发Action创建器发送一个Action在reducer中捕获该操作并创建一个新的更新状态在ReduxDevTools中查看更新状态但是,启用/禁用功能仍然不起作用,因为似乎mapStateToProps和connect实际上并未将状态映射到Prop。我正在跟踪canSubmit,它在状态内发生变化,但在props中是undefined。我缺少什么才能成功地将状态映射到Prop?相关代码:用户窗体ViewconstmapStateToProps=(state)=>({router

javascript - Gulp-inject 说 "Nothing to inject into index.html"

我试图在我的索引中注入(inject)一些文件,所有这些文件都连接并缩小到一个.tmp文件夹中,如下所示:gulp.task('prep-js',['clean'],function(){varjspath='./src/page/**/*.js';vartreatJs=gulp.src(jspath).pipe(plugins.concat('scripts.js')).pipe(plugins.uglify()).pipe(gulp.dest('.tmp/page/js'))});但是当我运行注入(inject)任务时,它显示“没有任何东西可以注入(inject)到index.ht

javascript - PokeAPI + Angular : How to get pokemon's evolution chain

我是Angular的新手,我正在通过尝试使用pokeapi为每个pokemon拉动进化链来学习一些东西,但由于嵌套很深,所以遇到了困难。一个典型的响应对象是这样返回的:{"baby_trigger_item":null,"id":2,"chain":{"evolution_details":[],"evolves_to":[{"evolution_details":[{"min_level":16,"min_beauty":null,"time_of_day":"","gender":null,"relative_physical_stats":null,"needs_overworl