SAP Spartacus B2B的List页面:

和回车键事件相关的实现:

<cx-table
*ngIf="data.values?.length > 0; else emptyList"
[structure]="structure"
[data]="data.values"
[i18nRoot]="domainType"
[currentItem]="{ property: key, value: currentKey$ | async }"
(launch)="launchItem($event)"
[cxFocus]="{ trap: 'both' }"
>
</cx-table>
调用栈:观察lock-focus.directive.ts里的handleEnter函数是如何被Angular core调用的:

传入focus directive的事件:KeyboardEvent
- code为Enter
- currentTarget: cx-table.vertical
- eventPhase: 3
- key: Enter
- keyCode: 13

类型:keydown


更多Jerry的原创文章,尽在:"汪子熙":

网友评论