相关疑难解决方法(0)

如何检测TypeScript中按下的键?

在javascript中以下行的typescript中语义等价的语法是什么

//Some knockout event handler.
myFunc(data : string, evt : Event) {
    //If enter or tab key up were detected add the excuse to the collection.
    if(evt.enterKey || evt.which == 9)
        //Do Something
}
Run Code Online (Sandbox Code Playgroud)

我遇到的麻烦不像常规的javascript事件,typescript事件类没有属性enterKeywhich.那么如何在不获取打字稿编译错误和丑陋的红色摇摆下划线的情况下检测哪个键被按下?

javascript knockout.js typescript

9
推荐指数
3
解决办法
3万
查看次数

标签 统计

javascript ×1

knockout.js ×1

typescript ×1