跳到主要内容

simulateKey 模拟键盘按键

simulateKey

类型: MethodDeclaration

定义位置: input.ts

描述

模拟键盘按键

参数 type: 键盘事件类型

参数 keycode: 键码

参数

参数名类型描述默认值
typestring--
keycodestring--

返回值

类型: void

源代码

位置: 第 322 行

public simulateKey(type: string, keycode: string): void {
const event = Input.event
window.dispatchEvent(new KeyboardEvent(type, {code: keycode}))
Input.event = event
}

文档生成时间:2025/7/7 12:07:06