Communitygithub.com

UI转Vue

当用户需要将UI截图或设计稿批量转换为Vue 3组件时使用,尤其适用于Vant、Element Plus或Ant Design Vue组件库。

UI转Vue 是什么?

UI转Vue是一个高效的批量转换工具,能够将UI设计截图自动转换为Vue 3 Composition API组件代码。它支持Vant(移动端)、Element Plus(桌面端)和Ant Design Vue(桌面端)三种主流组件库,适用于从设计稿到代码的快速一稿生成。该工具通过目录结构识别页面分组、UI元素映射、公共组件提取和路由自动生成等智能逻辑,显著提升开发效率。使用时只需通过npx命令运行,并设置DashScope API密钥(环境变量或配置文件方式),即可输入截图目录并输出完整的Vue组件代码,适合与Cursor、Claude Code等AI编程助手配合,快速启动Vue 3项目。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/ui-to-vue

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

UI 转 Vue

将UI设计截图批量转换为Vue 3 Composition API组件代码。

何时使用

  • 用户提供一个包含设计截图或设计导出图片的目录。
  • 目标应用是Vue 3。
  • 用户希望获得页面组件、共享组件和路由连接的初稿。
  • 用户指定了Vant、Element Plus或Ant Design Vue作为组件库。

何时不使用

  • 用户只有一张截图,且想要一个定制组件。
  • 目标项目不是Vue。
  • 设计要求详细的交互逻辑、数据流或无障碍性审查。
  • 截图包含不能发送到外部模型API的客户私有数据。

输入

使用一个按模块和页面状态分组截图输入目录:

screenshots/
|-- HomePage/
|   |-- List/
|   |   |-- [email protected]
|   |   `-- cut-images/
|   |-- cut-images/
|   `-- [email protected]
`-- cut-images/

支持的切图目录名称包括 assets、icons、sprites、cut、images 和 cut-images。

转换模型

  • 页面分组:当相关截图表示列表、详情、表单、加载或空状态时,将多个相关截图合并到一个页面组件中。
  • UI库映射:在可行的情况下,将原生视觉元素映射到Vant、Element Plus或Ant Design Vue组件。
  • 切图优先级:优先使用页面级资产,然后是模块级资产,最后是全局共享资产。
  • 组件提取:当UI区域出现多次时,将其提取为共享组件。

CLI用法

使用 npx 运行转换器,这样文档中的命令无需依赖全局二进制文件即可正常工作:

export DASHSCOPE_API_KEY=your_key
npx [email protected] --input ./screenshots --ui vant --output ./src

对于桌面端UI库:

npx [email protected] --input ./designs --ui element-plus --output ./src
npx [email protected] --input ./designs --ui antd-vue --output ./src

如果包已全局安装,可以直接使用 ui-to-vue 命令:

npm install -g [email protected]
ui-to-vue --input ./screenshots --ui vant --output ./src

选项

选项描述默认值
--input设计图片目录./screenshots
--uiUI库:vant、element-plus 或 antd-vuevant
--output输出目录./src
--config配置文件路径./.ui-to-vue.config.json

API密钥处理

转换器可以从配置文件或环境变量中读取DashScope凭据。建议在仓库中使用环境变量:

export DASHSCOPE_API_KEY=your_key

如果需要本地配置文件,请将其排除在版本控制之外:

{
  "apiKey": "your_dashscope_key",
  "input": "./designs",
  "ui": "vant",
  "output": "./src"
}
.ui-to-vue.config.json

安全与隐私

  • 将设计截图视为可能发送到外部模型API的源材料。
  • 未经许可不要在私有客户设计上运行此流程。
  • 在可重复的工作流程中锁定转换器的版本,而不是使用 @latest。
  • 在提交之前审查生成的Vue代码。
  • 不要提交 .ui-to-vue.config.json、API密钥、生成的密钥或客户截图。

输出审查清单

  • 页面组件已生成在 views/ 或指定的输出目录中。
  • 仅当复用明确时才将重复的UI区域提取到 components/ 中。
  • 路由输出与目标项目的路由风格兼容。
  • 生成的组件一致地使用请求的UI库。
  • 生成的CSS单位与设计基准匹配。
  • 代码通过了项目的格式化、代码检查、类型检查和构建流程。
  • 在提交前审查了占位文案、模拟数据和生成的资产。

故障排除

问题检查项
401 或认证错误确认在运行命令的shell中设置了 DASHSCOPE_API_KEY。
command not found: ui-to-vue使用 npx [email protected] 形式或全局安装包。
切图被忽略确认资产目录名称受支持,并且嵌套在匹配的页面或模块下。
组件忽略请求的UI库使用显式的 --ui 值重新运行,并检查生成的导入语句。
生成的布局尺寸看起来不对确认截图导出宽度与目标库基准匹配。

参考

  • npm包:ui-to-vue-converter

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相关技能