typescript 键盘3.ts

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript 键盘3.ts相关的知识,希望对你有一定的参考价值。

import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
import { ENTER } from '@angular/cdk/keycodes';

@Component({
 ...
})
export class AppComponent {
  @ViewChildren(ListItemComponent) items: QueryList<ListItemComponent>;
  users = [...]

  private keyManager: ActiveDescendantKeyManager<ListItemComponent>;

  ngAfterViewInit() {
    this.keyManager = new ActiveDescendantKeyManager(this.items).withWrap();
  }

  onKeydown(event) {
    if (event.keyCode === ENTER) {
      this.model = this.keyManager.activeItem.item.name;
    } else {
      this.keyManager.onKeydown(event);
    }
  }
}

以上是关于typescript 键盘3.ts的主要内容,如果未能解决你的问题,请参考以下文章

typescript 搜索3.ts

typescript 阿比 - 3.ts

typescript ML-3.ts

typescript SD-3.ts

typescript 1.8-3.ts

typescript CV-3.ts