如果我理解正确,您无法检索事件本身,而只能检索 jquery 事件的 js 版本(不是本机 dom 事件),因此您需要知道根据http://中的文档读取所需属性的外观api.jqueryui.com/slider/#event-change
void _onSliderChange(js.JsObject obj1, js.JsObject obj2) {
print(obj1['target']); // <= get the div
print(obj2['value']); // <= get the value
}
当您移动滑块时,它应该显示,例如
div (:1)
5 (:1)
正如你所说,有时很难处理/调试 JsObject 所以我写了一些帮助程序来将此类对象转换为 dart 集合(列表或地图)以用于调试目的https://github.com/alextekartik/tekartik_utils.dart/blob/ master/lib/src/js_utils/jsobject_converter.dart
void _onSliderChange(js.JsObject obj1,js.JsObject obj2) {
print(jsObjectKeys(obj1));
print(jsObjectAsCollection(obj1));
}
应该显示类似的东西
[originalEvent, type, isDefaultPrevented, timeStamp, jQuery110207535289276856929, target, toElement, screenY, screenX, pageY, pageX, offsetY, offsetX, fromElement, clientY, clientX, buttons, button, which, view, shiftKey, relatedTarget, metaKey, eventPhase, currentTarget, ctrlKey, cancelable, bubbles, altKey, delegateTarget, handleObj, data, isTrigger, namespace, namespace_re, result] (:1)
{originalEvent: {originalEvent: Instance of 'MouseEvent', type: mouseup, isDefaultPrevented: {}, timeStamp: 1409328507659, jQuery110207535289276856929: true, toElement: span, screenY: 624, screenX: 115, pageY: 545, pageX: 110, offsetY: 16, offsetX: 15, fromElement: null, clientY: 545, clientX: 110, buttons: null, button: 0, which: 1, view: <window>, target: span, shiftKey: false, relatedTarget: null, metaKey: false, eventPhase: 3, currentTarget: Instance of 'HtmlDocument', ctrlKey: false, cancelable: true, bubbles: true, altKey: false, delegateTarget: Instance of 'HtmlDocument', handleObj: {type: mouseup, origType: mouseup, data: null, handler: {guid: 23}, guid: 23, selector: null, needsContext: null, namespace: slider}, data: null}, type: slidechange, isDefaultPrevented: {}, timeStamp: 1409328507659, jQuery110207535289276856929: true, target: div, toElement: span, screenY: 624, screenX: 115, pageY: 545, pageX: 110, offsetY: 16, offsetX: 15, fromElement: null, clientY: 545, clientX: 110, buttons: null, button: 0, which: 1, view: <window>, shiftKey: false, relatedTarget: null, metaKey: false, eventPhase: 3, currentTarget: div, ctrlKey: false, cancelable: true, bubbles: true, altKey: false, delegateTarget: div, handleObj: {type: slidechange, origType: slidechange, data: null, handler: {guid: 17}, guid: 17, selector: null, needsContext: null, namespace: }, data: null, isTrigger: 3, namespace: , namespace_re: null, result: null} (:1)
您可能会从活动中找到您想要的房产