gpt4 book ai didi

internet-explorer - Dart:在IE11中提交表单时,preventDefault()在异步回调中不起作用

转载 作者:行者123 更新时间:2023-12-03 02:57:09 24 4
gpt4 key购买 nike

在IE11中提交表单时,Event.preventDefault()出现问题。出于某种原因,使用async回调时,它不会阻止浏览器刷新。

HTML:

<form id="login">
<input type="email" id="email" placeholder="Email">
<input type="password" id="password" placeholder="Password">
<input type="submit" value="SUBMIT">
</form>

镖:
void main() {
FormElement form = querySelector('form#login');
form.onSubmit.listen((Event e) async {
e.preventDefault();
// send login request
});
}

但是,如果删除 async关键字,它确实会阻止浏览器刷新。我是否在这里缺少某些东西,没想到它会像这样吗?在Chrome中,无论是否使用 async,它都可以使用。

最佳答案

这看起来像个错误。请在此处将其归档https://github.com/dart-lang/sdk/issues/new,我们来看一下。

关于internet-explorer - Dart:在IE11中提交表单时,preventDefault()在异步回调中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40773976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com