我使用 Rikulo/Bootjack 在模态窗口中输入参数,但 dquery 在 DartEditor-1.10.1(Win7 和 Linux)中生成多个异常“Class 'TransitionEvent' has no instance getter 'relatedTarget'”,首选项:运行和调试:打破例外:所有。问题是什么?这是示例代码:
索引.html:
<html>
<head>
<meta charset="utf-8">
<title>bootjack_test</title>
<link rel="stylesheet" href="packages/bootjack/css/bootstrap.min.css">
<script async src="main.dart" type="application/dart"></script>
</head>
<body>
<a href="#modalNewItem" role="button" class="btn btn-primary" data-toggle="modal">New item</a>
<div id="modalNewItem" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4>New item creation:</h4>
</div>
<div class="modal-body">
Item name: <input type="text" id="inputItemName">
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">Cancel</button>
<button class="btn btn-primary" id="btnCreateItem">Create</button>
</div>
</div>
</div>
</div>
</body>
</html>
主要飞镖:
import 'dart:html';
import 'package:dquery/dquery.dart';
import 'package:bootjack/bootjack.dart';
void main() {
Modal.use();
Transition.use();
Modal modal = Modal.wire(querySelector('#modalNewItem'));
$('#btnCreateItem').on('click', (QueryEvent e) {
var itemName = (querySelector('#inputItemName') as TextInputElement).value.trim();
if (itemName.length == 0) {
print('ERROR: empty item name');
} else {
print('OK: item name = $itemName');
modal.hide();
}
});
}
该问题在 rikulo/bootjack GitHub 的 bootjack example/modal 中重现,我打开了相应的问题请求:https ://github.com/rikulo/bootjack/issues/25