如何从Dart调用jQuery函数? [英] How to call a jQuery function from Dart?

查看:74
本文介绍了如何从Dart调用jQuery函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是jQuery中的典型情况:

This is a typical situation in jQuery:

$(".myClass").myFunction({
    aKey: 'some value'
});

如何使用dart调用它:js?

How do you call that using dart:js?

文档有点神秘和类似问题,我发现这里似乎过时了。

The documentation is a bit cryptic and a similar question that I found here seems dated.

推荐答案

您可以:

main() {
  js.context.callMethod(r'$', ['.myClass'])
      .callMethod('myFunction', [new js.JsObject.jsify({'aKey': 'some value'})]);
}

这篇关于如何从Dart调用jQuery函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆