Kbd (按键)
键盘快捷键徽标:Mod 在 Apple 上显示 ⌘、其它平台显示 Ctrl,读屏器读键名而不是符号。
基础用法
keys 里 + 连接同时按下的键,空格分隔先后按下的键。Mod 在 Apple 设备上是 ⌘,其它平台是 Ctrl;服务端渲染 Ctrl,Mac 在挂载后切换。读屏器读到的是键名("Command K"),不是符号。
CtrlKCtrlShiftZAlt上箭头Ctrl回车Esc
Basic.vue
行内
尺寸按 em 计算,放在正文、提示框或按钮里都跟随所在文字的字号。
按 Ctrl回车 发送,Shift回车 换行。
在帖子列表里依次按 G然后G 回到顶部,按 J / K 切换上下一帖。
字号跟随正文:CtrlShiftP
InText.vue
搜索入口
SearchTrigger.vue
纯文本
variant="plain" 是菜单里的写法:Apple 上 ⇧⌘Z,其它平台 Ctrl+Shift+Z。
- 撤销 Ctrl Z
- 重做 Ctrl Shift Z
- 删除 Ctrl 退格
Plain.vue
属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| keys | string | "" | Key combination, rendered for the viewer's platform: `+` joins a chord and a space separates a sequence (`'Mod+K'`, `'Shift+Delete'`, `'G G'`). `Mod` is ⌘ on Apple and Ctrl elsewhere; the server renders Ctrl and a Mac switches after mount. Screen readers hear key names, not glyphs. Without it, the default slot is shown as one key. |
| variant | "keycap" | "plain" | "keycap" | `keycap` draws each key as a cap. `plain` is one line of muted text, the way a menu shows a shortcut: `⇧⌘Z` on Apple, `Ctrl+Shift+Z` elsewhere. |
插槽
| 插槽 | 作用域 | 说明 |
|---|---|---|
| #default | any | A single key written out, shown when `keys` is not set. |