feat: 调整README.md

tujiawei 2023-10-09 19:57:00 +08:00
parent 6556d213c1
commit 1fb5866048
1 changed files with 10 additions and 7 deletions

View File

@ -10,11 +10,11 @@
> 键盘 > 键盘
```js ```js
import Keyboard from 'http://unpkg.bytedo.org/@bytedo/keyboard/dist/index.js' import { KeyboardV1, KeyboardV2 } from 'http://unpkg.bytedo.org/@bytedo/keyboard/dist/index.js'
var kb = new Keyboard() var kb = new KeyboardV2()
// 默认整个document监听, 也可以单独对局部起效 // 默认整个document监听, 也可以单独对局部起效
// var kb = new Keyboard(document.querySelector('.foo')) // var kb = new KeyboardV2(document.querySelector('.foo'))
// 同时按Ctrl键和C键, 触发回调 // 同时按Ctrl键和C键, 触发回调
kb.on(['ctrl + c'], ev => { kb.on(['ctrl + c'], ev => {
@ -113,9 +113,12 @@ kb.on(['ctrl + c', 'ctrl + v'], ev => {
| Tab | tab | 制表符键 | | Tab | tab | 制表符键 |
| Cmd/Win | meta | Command/Win键(1.x版不区别左右) | | Cmd/Win | meta | Command/Win键(1.x版不区别左右) |
| Space | space | 空格键 | | Space | space | 空格键 |
| Ctrl | ctrl | Ctrl键(1.x版不区分左右) | | Ctrl(同shift) | ctrl | Ctrl键(1.x版不区分左右) |
| Shift | shift | Shift键(1.x版不区分左右) | | Shift | shift | Shift键(1.x) |
| Alt/Option| alt | Alt/Option键(1.x版不区分左右) | | Shift(left) | shift_left | 左侧Shift键(2.x) |
| Shift(right) | shift_right | 右侧Shift键(2.x) |
| Alt/Option(同shift) | alt/option | Alt/Option键(1.x版不区分左右) |
| Win/Cmd(同shift) | win/cmd | Win/Cmd只存在于2.x版本 |
| Enter | enter | 回车键(1.x版不区分小数字键盘的回车) | | Enter | enter | 回车键(1.x版不区分小数字键盘的回车) |
| ' | ' | 单引号键 | | ' | ' | 单引号键 |
| * | * | 小数字键盘中的乘号 | | * | * | 小数字键盘中的乘号 |
@ -128,5 +131,5 @@ kb.on(['ctrl + c', 'ctrl + v'], ev => {
| = | = | 等号 | | = | = | 等号 |
| [ | [ | 左边中括号 | | [ | [ | 左边中括号 |
| ] | ] | 右边中括号 | | ] | ] | 右边中括号 |
| ` | ` | 反引号(Tab上面的键) | | ` | ` | 反引号(Tab上面的键) ||
| \ | \ | 反斜杠 | | \ | \ | 反斜杠 |