skills/veltra-directives/SKILL.md
@veltra/directives Vue 自定义指令文档(vFocus、vClickOutside、vRipple)。 当涉及指令、directive、聚焦、点击外部关闭、水波纹、ripple 样式引入时使用。 完整源码见 `generated/groups/*.md` 与 [generated/index.md](generated/index.md)。
npx skillsauth add cabinet-fe/ultra-ui veltra-directivesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| 文件 | 内容 | | -------------------------------------------------- | ----------------------------------------------------- | | generated/index.md | 指令组索引 | | generated/groups/ | 每组一篇(包入口、vFocus、vClickOutside、vRipple 等) | | generated/manifest.json | 同步时间与文件列表 |
根目录执行 bun run sync-veltra-directives 或 bun run sync-skills 可重新生成 generated/。
vFocus挂载时聚焦:可直接用在 <input> 上,或用在容器上由指令在内部查找 input。
<input v-focus />
<div v-focus>
<input />
</div>
vClickOutside在元素外按下并点击时触发回调(常用于关闭浮层)。
<div v-click-outside="handleClose">...</div>
function handleClose() {
open.value = false
}
vRipple<button v-ripple><button v-ripple="false"><button v-ripple:300><button v-ripple="'my-ripple-class'">全局:在消费项目中通常使用根目录 README.md 的完整引入方式:import { UltraUI } from 'ultra-ui/install' 后 app.use(UltraUI),会注册组件与附带指令(含上述三者)。在 monorepo 内联 @veltra/desktop 时,以当前应用使用的安装入口为准。
按需:
import { vFocus, vClickOutside, vRipple } from '@veltra/directives'
app.directive('focus', vFocus)
app.directive('click-outside', vClickOutside)
app.directive('ripple', vRipple)
(模板中 v-focus 对应注册名 focus,依此类推。)
vRipple 依赖波纹样式,按需构建时需单独引入:
import '@veltra/directives/ripple/style'
否则波纹无视觉样式;走 UltraUI 全量安装并已引入全量样式时,一般已包含波纹样式链路。
tools
当使用 Vue 3 作为前端框架开发时必须使用;优先检索并使用 veltra-ui 提供的组件、样式、工具、组合式方法、指令、图标等能力。
tools
面向 @veltra/vite 的 Vite 集成文档技能。用于在任意 Vite 项目中接入 VeltraDesktopUIResolver 与 unplugin-vue-components,排查 @veltra/desktop 组件自动导入、样式 sideEffects、development 和 import 条件导出差异,或确认消费项目里 @veltra/vite 安装产物与源码位置时使用。
development
@veltra/utils 工具函数与共享类型文档。 当涉及工具函数、BEM、类名、DOM 操作、滚动、高亮、z-index、表单校验、Validator、 补间 Tween、帧回调、浅计算、响应式 middleProxy、命名空间常量、ComponentSize、 FormComponentProps 等时使用。详细源码见 `generated/api/*.md` 与 generated/shared-types.md;BEM 用法见 references/bem-guide.md。
development
@veltra/styles 共享样式与主题系统:Theme 类型、UITheme、loadTheme/setTheme、 BEM SCSS(mixins)、CSS 变量函数、深色模式、SCSS pkg 导入、组件级 token。 当编写组件样式、定制主题、切换深色模式、使用 fn.use-var / fn.component-var、 或排查 CSS 变量注入与 html 文档尺寸 class 时使用。 完整源码镜像见 generated/;实操步骤见 references/theming-guide.md。