zl程序教程

您现在的位置是:首页 >  其他

当前栏目

SAP Spartacus B2B ListComponent响应回车事件的实现

SAP事件响应 实现 Spartacus B2B 回车
2023-09-14 09:02:55 时间

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的原创文章,尽在:“汪子熙”: