@abcum/ember-hotkey 中文文档教程

发布于 5年前 浏览 20 项目主页 更新于 3年前

ember-hotkey

用于响应键盘事件的 Ember.js 组件。

Usage

Installation

ember install @abcum/ember-hotkey

General usage

key 属性定义了哪个键盘 必须按下键才能激活回调。

{{hot-key key="s" meta=true on-press=(action 'save')}} {{!-- cmd+s --}}

修饰符属性 altmetactrlshift 可用于启用高级组合键。

{{hot-key key="v" ctrl=true on-press=(action 'paste')}} {{!-- ctrl+v --}}

添加多个修饰符以指定需要一起按下才能激活回调的键组合。

{{hot-key key="3" meta=true shift=true on-press=(action 'screenshot')}} {{!-- cmd+shift+3 --}}

Development

  • make install (install bower and ember-cli dependencies)
  • make upgrade (upgrade ember-cli to the specified version)
  • make tests (run all tests defined in the package)

ember-hotkey

An Ember.js component for reacting to keyboard events.

Usage

Installation

ember install @abcum/ember-hotkey

General usage

The key attribute defines which keyboard key must be pressed to activate the callback.

{{hot-key key="s" meta=true on-press=(action 'save')}} {{!-- cmd+s --}}

The modifier attributes alt, meta, ctrl, shift can be can be used to enable advanced key combinations.

{{hot-key key="v" ctrl=true on-press=(action 'paste')}} {{!-- ctrl+v --}}

Add multiple modifiers to specify combinations of keys which need to be pressed together in order to activate the callback.

{{hot-key key="3" meta=true shift=true on-press=(action 'screenshot')}} {{!-- cmd+shift+3 --}}

Development

  • make install (install bower and ember-cli dependencies)
  • make upgrade (upgrade ember-cli to the specified version)
  • make tests (run all tests defined in the package)
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文