For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/lynx-api/event/key-event.md.
Lynx
  • 简体中文
  • KeyEvent

    表示键盘事件,继承自 Event,用于描述用户与键盘的交互行为。每一个事件都描述了用户与一个按键,或按键与修饰键组合的一次交互。

    实例属性

    key

    key: string;

    表示用户按下的物理按键的值。

    repeat

    repeat: boolean;

    true 表示按键被持续按住并自动重复触发。

    altKey

    altKey: boolean;

    true 表示事件发生时 Alt 键处于按下状态;在 macOS 中,对应 Option()键。

    ctrlKey

    ctrlKey: boolean;

    true 表示事件发生时 Ctrl 键处于按下状态。

    metaKey

    metaKey: boolean;

    true 表示事件发生时 Meta 键处于按下状态。在 macOS 中对应 Command()键,在 Windows 中对应 Windows 键。

    shiftKey

    shiftKey: boolean;

    true 表示事件发生时 Shift 键处于按下状态。

    KeyEvent 的类型

    keydown

    表示一个按键被按下。

    keyup

    表示一个按键被释放。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。