Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 JS/HTML 中很常见,<a onclick="func(event)">当我使用 dart 时如何引用事件变量?当我尝试执行此操作时出现错误,提示未找到该事件。
<a onclick="func(event)">
好的,经过一番研究,事实证明你必须使用 $event。
一个更完整的例子:
<input id="foo" type="text" on-change="itChanged($event)">
在 Dart 文件中:
itChanged(Event event) { print(event.target.id); }