标签: clojurescript reagent
我有一个输入字段
[:input {:type "text"}]
我需要检测用户在编辑该字段时何时按下Esc键。我该怎么做?
答案 0 :(得分:1)
向元素添加:on-key-up(或:on-key-down)处理程序:
:on-key-up
:on-key-down
[:input {:type "text" :on-key-up #(when (= 27 (.-which %)) (do-something-here))}]