搜索与执行
查询匹配名称、说明和 keywords,不区分大小写,多个词都需匹配。保持宿主组与命令顺序;不自动猜测拼音或错别字。方向键高亮不会执行;Enter 或点击有效结果触发 select,查询保持原样。同一条命令可以再次执行。
分组、图标与快捷键
groups 与 items 使用稳定唯一 key。leading/trailing 只放图标、Kbd、Tag 等静态内容;不要在结果行里嵌套其他按钮。keys 仅显示快捷键,不自动注册。
受控查询
v-model:search 支持宿主同步查询。未绑定时使用 defaultSearch 初始化;过滤和状态变化保留同一个输入节点。
禁用与空数据
disabled 禁用整项搜索;item.disabled 保留命令说明,但不允许执行。disabledReason 明确解释不可用原因。无结果提供已有 EmptyState,不将空白误当作加载。
远程搜索与恢复
filter="none" 由宿主提供结果,loading 禁止执行旧结果。errorText 替换结果并提供 retry;查询不会被清空。示例模拟延迟、请求代次与取消:较旧的回复不得覆盖最新输入。
对话框与宿主快捷键
QuireCommandPaletteDialog 组合现有 Dialog,打开聚焦输入,Escape 一次关闭并返回触发器。Cmd/Ctrl+K 由本示例宿主注册与卸载;组件本身不接管全局快捷键。关闭后查询保留。
异步执行与焦点交接
select 只表示请求执行,不代表成功,也不自动关闭。busy 阻止重复激活,允许取消和保留查询;失败继续显示恢复说明。成功后宿主关闭并通过 finalFocusEl 将焦点交给结果区域。请求与权限始终由业务层处理。
控件密度
size 调整搜索输入,默认 sm;density="compact|regular" 独立调整结果行,默认 regular。多行说明自然增高,结果区域在可用高度内滚动。
长名称与阅读方向
长内容完整换行,快捷键保留独立留白;窄屏中快捷键另起一行,避免挤压命令名称或撑破键帽。结果区域内部滚动,键盘高亮始终滚入可见区域。RTL 由 Ark LocaleProvider 与宿主方向共同控制。高亮使用语义软色,键盘焦点留在输入。
API
QuireCommandPalette Props
Slots 内容位置
leadingStatic leading icon or avatar.
{ /** Original host command. */ item: { /** Globally unique stable identity. */ key: string; /** Readable command name. */ label: string; /** Supporting explanation, never truncated by default. */ description?: undefined | string; /** Additional terms searched without displaying them. */ keywords?: undefined | readonly (string)[]; /** Prevents activation while preserving discoverability. */ disabled?: boolean | undefined; /** Readable explanation for unavailable commands. */ disabledReason?: string | undefined; /** Display-only shortcut keys; the host registers shortcuts. */ keys?: readonly string[] | undefined; }; }trailingStatic shortcut or supporting badge.
{ /** Original host command. */ item: { /** Globally unique stable identity. */ key: string; /** Readable command name. */ label: string; /** Supporting explanation, never truncated by default. */ description?: undefined | string; /** Additional terms searched without displaying them. */ keywords?: undefined | readonly (string)[]; /** Prevents activation while preserving discoverability. */ disabled?: boolean | undefined; /** Readable explanation for unavailable commands. */ disabledReason?: string | undefined; /** Display-only shortcut keys; the host registers shortcuts. */ keys?: readonly string[] | undefined; }; }footerOptional explanatory footer or host controls outside the result list.
any
Events 组件事件
escape[event: KeyboardEvent]retry[]update:search更新
search,可通过对应 v-model 绑定。[search: string]select[item: QuireKitCommandPaletteItem]
公开实例成员
focus() => voidgetInputElement() => HTMLInputElement | null
QuireCommandPaletteDialog Props
Slots 内容位置
triggerSingle existing Button receiving Ark trigger behavior.
anyleadingStatic leading icon or avatar.
{ /** Original host command. */ item: { /** Globally unique stable identity. */ key: string; /** Readable command name. */ label: string; /** Supporting explanation, never truncated by default. */ description?: undefined | string; /** Additional terms searched without displaying them. */ keywords?: undefined | readonly (string)[]; /** Prevents activation while preserving discoverability. */ disabled?: boolean | undefined; /** Readable explanation for unavailable commands. */ disabledReason?: string | undefined; /** Display-only shortcut keys; the host registers shortcuts. */ keys?: readonly string[] | undefined; }; }trailingStatic shortcut or supporting badge.
{ /** Original host command. */ item: { /** Globally unique stable identity. */ key: string; /** Readable command name. */ label: string; /** Supporting explanation, never truncated by default. */ description?: undefined | string; /** Additional terms searched without displaying them. */ keywords?: undefined | readonly (string)[]; /** Prevents activation while preserving discoverability. */ disabled?: boolean | undefined; /** Readable explanation for unavailable commands. */ disabledReason?: string | undefined; /** Display-only shortcut keys; the host registers shortcuts. */ keys?: readonly string[] | undefined; }; }footerOptional explanatory footer or host controls outside the result list.
any
Events 组件事件
retry[]update:open更新
open,可通过对应 v-model 绑定。[open: boolean]update:search更新
search,可通过对应 v-model 绑定。[search: string]select[item: QuireKitCommandPaletteItem]