我正在使用反应树组件:
<DirectoryTree
loadData={this._onLoadData}
onSelect={this._onSelectFile}
onExpand={this._onExpand}
multiple={false}
>
{this._onRenderTreeNodes(this.state.treeData)}
</DirectoryTree>
当我调用this.onExpand
函数时:
onExpand = (expandedKeys) => {
console.log('onExpand', expandedKeys);
}
我得到了预期的输出:
onExpand ["b!iaZLDKoCOkGwAWVOA_F7GfKHNlmMu6pJtPkRTH9QdhWZAlQzj2spQIyBb3IvBVBM"]0: "b!iaZLDKoCOkGwAWVOA_F7GfKHNlmMu6pJtPkRTH9QdhWZAlQzj2spQIyBb3IvBVBM"length: 1__proto__: Array(0)
当我使用this._onExpand
函数调用它时:
@autobind
private _onExpand(expandedKeys): void {
console.log("_onExpand | expandedKeys: ", event);
}
我收到了鼠标事件
_onExpand | expandedKeys: MouseEvent {isTrusted: true, screenX: 3380, screenY: 231, clientX: 1441, clientY: 142, …}
我不了解幕后发生的事情来解释这一点。有人可以向我解释吗?