HoverCard (悬停卡片)

鼠标悬停或键盘聚焦在链接上时浮出的预览卡片,点击照常跟随链接,触屏上不出现。

基础用法

鼠标停在链接上 openDelay(默认 600ms)后浮出,移开后留 closeDelay 的余量,沿安全三角移进卡片不会关闭,卡片里的按钮照常可点。 点击不被拦截:点头像照常跟随链接,同时关闭卡片,不会跟着页面切换残留。 触屏上不出现——轻点就是打开链接。

发布于 3 小时前
Basic.vue

列表中的分组

同一 group 的卡片同时只开一张;一张打开后移到相邻头像立即切换,不再等 openDelay。触发器外层是 display: contents, 不产生盒子,放进 flex 行里不改变头像的布局。

  • 鲲

    鲲

    补丁已经更新到 1.2,之前存档不兼容的问题修好了。

  • KUN Galgame

    KUN Galgame

    感谢汉化组,周末就去通关。

  • 路过的旅人

    路过的旅人

    请问 Steam 版能直接用这个补丁吗?

Group.vue

打开时加载

卡片内容只在打开期间挂载,放在内容组件 setup 里的请求就是在打开时发出的。 需要在外面知道开合(预取、埋点)时绑定 v-model:open。

LazyContent.vue

键盘与读屏

键盘 Tab 到链接(:focus-visible)时同样在 openDelay 后打开, 离开或按 Esc 关闭;鼠标点击带来的聚焦不会打开。卡片是补充预览:没有 role, 不移动焦点,也不在 Tab 顺序里,链接本身始终是唯一的可访问入口——所以不要把 目标页面上没有的信息或操作只放在卡片里。需要可交互、可聚焦的浮层用 KunPopover。

属性

属性类型默认值说明
autoPositionbooleantrueAvoid viewport collisions: flip to the opposite side, shift along the edge, and cap height/width to the available space so tall content scrolls instead of overflowing. Set `false` to honour `position` verbatim.
closeDelaynumber300ms grace after the pointer leaves the trigger or the card, long enough to cross the gap between them.
disabledbooleanfalseRender the trigger alone, with no card and no listeners. For a trigger that has nothing to preview, such as a deleted user.
groupstring—Shared id for a list of cards (every author avatar on a page): only one is open at a time, and once one is open, moving to a sibling switches at once instead of waiting out `openDelay` again.
innerClassstring""Classes for the floating panel.
opaquebooleanfalseForce a fully opaque panel, ignoring a globally lowered `--kun-surface-opacity`. See KunPopover's `opaque`.
openbooleanfalseWhether the card is open. Bind `v-model:open` to prefetch or track it, or to close it from outside.
openDelaynumber600ms a mouse must rest on the trigger, or keyboard focus stay on it, before the card opens.
positionKunPopoverPosition"bottom-start"Placement relative to the trigger.
roundedKunUIRounded—Corner radius of the card. Left unset it follows the app-wide config.
showArrowbooleanfalseRender a caret pointing at the trigger.

事件

事件回调参数
update:openvalue: boolean

插槽

插槽作用域说明
#default{ close: () => void; }The card. Mounted only while open, so a fetch in its setup runs on open.
#triggeranyThe element the card previews, usually a link. The card anchors to its first element.