Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Callback 参数不匹配的闭包调用:函数';呼叫';再一次_Callback_Dart_Dart Js Interop - Fatal编程技术网

Callback 参数不匹配的闭包调用:函数';呼叫';再一次

Callback 参数不匹配的闭包调用:函数';呼叫';再一次,callback,dart,dart-js-interop,Callback,Dart,Dart Js Interop,就在一个月前,我在jsinterop中遇到了这个问题 现在我对图书馆也有同样的问题。我从一开始就将它与JsInterop结合使用。今天我尝试使用这个函数,我得到了同样的异常 但当我将SVG元素悬停时,我的函数会被触发四次: hover in hover in hover in hover in Breaking on exception: Closure call with mismatched arguments: function 'call' 我试过: var img=s.image(

就在一个月前,我在jsinterop中遇到了这个问题

现在我对图书馆也有同样的问题。我从一开始就将它与JsInterop结合使用。今天我尝试使用这个函数,我得到了同样的异常

但当我将SVG元素悬停时,我的函数会被触发四次:

hover in
hover in
hover in
hover in 
Breaking on exception: Closure call with mismatched arguments: function 'call'
我试过:

var img=s.image($url),x,y,image.width/2,image.height/2);
js.FunctionProxy hover=new js.FunctionProxy((){
打印(“悬停”);
});
img.鼠标悬停(悬停);

var img=s.image($url),x,y,image.width/2,image.height/2);
img.mouseover(){
打印(“悬停”);
});

这次我检查了两次,回调函数没有额外的参数。

考虑到您粘贴的日志,mouseover处理程序似乎有时会使用参数调用,有时则不使用参数。要处理此问题,可以使用带有可选参数的函数:

var img=s.image($url),x,y,image.width/2,image.height/2);
模拟鼠标悬停([p1、p2、p3、p4]){
打印(“悬停”);
});

上面的回调现在处理具有0到4个参数的调用。

Damn。。。它成功了。。。这很奇怪。。。再次感谢你,亚历山大!