草庐IT

method-dispatch

全部标签

javascript - 未捕获的类型错误 : Object [object Object] has no method 'apply'

我在创建的新网站上收到此UncaughtTypeError,但我无法找出导致该错误的原因。我在下面的链接中重现了这个问题,如果您查看浏览器的JS控制台,您会看到发生了错误,但没有其他任何反应。http://jsfiddle.net/EbR6D/2/代码:$('.newsitem').hover($(this).children('.text').animate({height:'34px'}),$(this).children('.text').animate({height:'0px'}));​ 最佳答案 确保将它们包装在异步回调

javascript - Selenium 网络驱动程序 : execute_script can't execute custom methods and external javascript files

我正在使用Selenium和Python,我正在尝试做两件事:导入外部javascript文件并执行其中定义的方法在字符串上定义方法并在求值后调用它们这是第一种情况的输出:测试.jsfunctionhello(){document.body.innerHTML="testing";}Python代码>>>fromseleniumimportwebdriver>>>f=webdriver.Firefox()>>>f.execute_script("vars=document.createElement('script');\...s.src='file://C:/test.js';\..

javascript - redux 的 dispatch() 中的 [[Scopes]] 是什么

我正在使用redux和react。这使得dispatch可以作为组件中的Prop使用。因此,当我console.log(this.props)时,我在调度键下的日志中看到以下对象。[[Scopes]]:Scopes[5]0:Closure1:Closure2:Closure(createThunkMiddleware)3:Closure4:Global谁能解释一下这是什么? 最佳答案 [[Scopes]]是Chrome开发者工具在内部添加和使用的私有(private)属性,在C++中,hereinthesource.它显示函数范围内

javascript - 未捕获的类型错误 : Cannot call method 'replace' of undefined underscore. js

我是backbone.js和underscore.js的新手。HTML:我调用View文件的地方:JS函数(与javascript项目配合良好):functionCart(){......this.showCart=function(){varitem=deserializeJSONToObj(window.localStorage.getItem(Cart.storageName));varstr='';str+='ItemtobuyQuantity';$.each(item,function(i,item){str+=''+trimString(item.Name,50)+'Ava

javascript - Flux 抛出 Dispatcher 不是构造函数

我尝试将jspm与reactjs一起使用。我工作得很好。但是当我将它与npm的flux包集成时。然后它总是抛出Dispatcherisnotaconstructor错误。我的代码如下AppDispatcher.jsimportFluxfrom'flux';exportdefaultnewFlux.Dispatcher();StoreBase.js'usestrict';import{EventEmitter}from'events';importAppDispatcherfrom'../dispatchers/AppDispatcher';constCHANGE_EVENT='chan

javascript - Node.js 类型错误 : Object function Object() { [native code] } has no method 'assign'

每当我执行我的程序时,我都会收到以下TypeError:/home/Node-Project/node_modules/sentiment/lib/index.js:31afinn=Object.assign(afinn,inject);^TypeError:ObjectfunctionObject(){[nativecode]}hasnomethod'assign'atmodule.exports(/home/Node-Project/node_modules/sentiment/lib/index.js:31:24)atEventEmitter.(/home/Node-Projec

javascript - Stenciljs @Method 不工作

我正在努力让stenciljs中的@Method正常工作-我们将不胜感激。这是我的组件代码,其中包含一个名为setName的函数,我想在我的组件上公开它:import{Component,Prop,Method,State}from"@stencil/core";@Component({tag:"my-name",shadow:true})exportclassMyComponent{@Prop()first:string;@Prop()last:string;@State()dummy:string;@Method()setName(first:string,last:string)

javascript - 为什么鼠标悬停事件不为谷歌地图中的折线分派(dispatch)?

我有一个复杂的流程,我必须为map上的每条折线附加鼠标悬停事件。附加事件的代码很简单:google.maps.event.addListener(polyline,"mouseover",function(){console.log('eventfired');});但是事件附加到少数多段线而不是其他多段线。可能是什么原因?编辑以下是在上述代码之前的更多代码,用于定义折线:this.polyline=newgoogle.maps.Polyline({path:[fromPosition,toPosition],strokeColor:'#CCCCCC',strokeOpacity:1.

javascript - 未捕获的类型错误 : Object [object Object] has no method 'datepicker'

这是我在尝试使用日期选择器小部件时遇到的错误:*没有方法$(function(){$("#from").datepicker({....}});$("#to").datepicker({....}});});这是我正在使用的包含文件。令人困惑的部分是我在3页上使用了相同的包含文件,但我只在一页上收到错误。所以它不可能真的是脚本本身......我认为有什么想法吗? 最佳答案 修复了$上的jQuery冲突添加了一个jQuery(function($){来解决问题 关于javascript-未

javascript - 未捕获的类型错误 : Cannot call method 'replace' of null

如果我在ChromeJS控制台上输入“_.template($('#pranks-list').html())”,它也能正常工作>>_.template($('#pranks-list').html())function(a){returne.call(this,a,b)}应用程序.js//Viewwindow.PranksListView=Backbone.View.extend({template:_.template($('#pranks-list').html())});索引.html'>为什么我会在这一行出现这个错误??template:_.template($('#pran