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
编译的dart代码未在IE 10和IE 11中运行_Dart_Internet Explorer 10_Internet Explorer 11_Dart2js - Fatal编程技术网

编译的dart代码未在IE 10和IE 11中运行

编译的dart代码未在IE 10和IE 11中运行,dart,internet-explorer-10,internet-explorer-11,dart2js,Dart,Internet Explorer 10,Internet Explorer 11,Dart2js,我在Chrome和Firefox上运行得非常好的一个小dart应用程序上遇到了问题,而且。。。猜猜看。。。。不在IE 10和11中(Win10预览版中的Project Spartan工作!) 这是一个简单的UI控制逻辑,如下所示: ... //init elements SelectElement studyList = querySelector('#studies'); SelectElement roleList = querySelector('#roles'); SelectEleme

我在Chrome和Firefox上运行得非常好的一个小dart应用程序上遇到了问题,而且。。。猜猜看。。。。不在IE 10和11中(Win10预览版中的Project Spartan工作!)

这是一个简单的UI控制逻辑,如下所示:

...
//init elements
SelectElement studyList = querySelector('#studies');
SelectElement roleList = querySelector('#roles');
SelectElement siteList = querySelector('#sites');
ButtonElement createButton = querySelector('#create');

//Kick in the UI logic
_populateStudies();

//UI logic
_populateStudies() {
  for (var study in studies) {
    OptionElement option = new OptionElement();
    option.text = study;
    studyList.children.add(option);
  }
  for (OptionElement element in studyList.children) {
    throw new Exception("ADDING_HANDLER");
//执行以下操作时,处理程序似乎已连接

    element.onClick.listen(_studyClickHandler);
  }
}
//从此不再在IE中执行

_studyClickHandler(Event e) {
  siteList.children.clear();
  roleList.children.clear();
  _populateRoles();
}

_populateRoles(){
  List<String> roles = context.getRolesFor(studyList.selectedOptions[0].text);
  for (var role in roles) {
    OptionElement option = new OptionElement();
    option.text = role;
    roleList.children.add(option);
  }
  for (OptionElement element in roleList.children) {
    element.onClick.listen(_roleClickHandler);
  }
}
...
控制台完全没有显示错误。 也许有一个简单的解决方法,但我对dart比较陌生,不能理解它

谢谢


我猜在您提到的浏览器中,
不支持
单击
处理程序注册。或者,您也可以在
SelectElement.onChange
上注册回调,并使用以下内容检索所选内容:

导入'dart:html';
void main(){
SelectElement select=querySelector('select');
选择.onChange.listen((){
final opt=select.options[select.selectedIndex];
打印(可选值);
});
}

您可以使用这些浏览器。

请添加一个代码示例,其中包含我们可以在浏览器中运行的所有代码。这取决于AJAX调用获取的数据。我会试着模仿一下,然后发布一段令人惊叹的代码……非常感谢!这解决了我的问题。还有一个问题:在这种情况下,是我还是(不遵守惯例?;-)
onClick.listen((_){
  handle stuff
});