无法从context.callMethod访问jQuery

时间:2014-09-16 22:14:49

标签: dart dart-js-interop

我正在尝试通过dart:js context对象添加handsontable,但收到错误:

Exception: Uncaught Error: NoSuchMethodError: method not found: 'jQuery'
Receiver: Instance of 'JsObject'
Arguments: ["#handsontable"]

我的HTML:

<script src="../lib/jquery-1.11.1.js"></script>
<script src="../lib/jquery.handsontable.full.js"></script>
<link rel="stylesheet" media="screen" href="../lib/jquery.handsontable.full.css">
<script type="javascript">
    $(document).ready(function(){
        console.log('jquery initialized' + $('#handsontable'));
    })
</script>

<script async type="application/dart" src="propmgmt.dart"></script>
<script async src="packages/browser/dart.js"></script>

这样称呼它:

var hot_data = new JsObject.jsify({
    'colHeaders': colHeaders,
    'data': rows
});
print('jQuery (as \$): ${context[r'$']}');
print('jQuery: ${context['jQuery']}');

context
  .callMethod('jQuery', ['#handsontable'])
  .callMethod('handsontable', [hot_data]);

“jquery initialized”未显示在控制台中。

0 个答案:

没有答案