Dart 中的 trigger() 等价物?
trigger() equivalent in Dart?
dart 中有 jquery 的触发器吗?
$( "#foo" ).on( "custom", function( event, param1, param2 ) {
alert( param1 + "\n" + param2 );
});
$( "#foo").trigger( "custom", [ "Custom", "Event" ] );
或
$( "#foo" ).on( "modal-click", function() {
alert( $( this ).text() );
});
$( "#foo" ).trigger( "modal-click" );
谢谢!
我想你在找 element.dispatchEvent()
我不久前将一些 jQuery 代码移植到 Dart 中,但在翻译这些代码时遇到了一些麻烦,因为 trigger
有一些额外的功能。 https://pub.dartlang.org/packages/dquery 可能包含更好的替代品。
dart 中有 jquery 的触发器吗?
$( "#foo" ).on( "custom", function( event, param1, param2 ) {
alert( param1 + "\n" + param2 );
});
$( "#foo").trigger( "custom", [ "Custom", "Event" ] );
或
$( "#foo" ).on( "modal-click", function() {
alert( $( this ).text() );
});
$( "#foo" ).trigger( "modal-click" );
谢谢!
我想你在找 element.dispatchEvent()
我不久前将一些 jQuery 代码移植到 Dart 中,但在翻译这些代码时遇到了一些麻烦,因为 trigger
有一些额外的功能。 https://pub.dartlang.org/packages/dquery 可能包含更好的替代品。