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 函式庫,並能根據設計截圖的目錄結構(如模組資料夾、頁面狀態子資料夾)自動分組頁面、提取共用元件,並產生對應的路由設定。此工具適用於快速建立 Vue 3 專案的初版頁面與元件骨架,但不宜於處理包含機敏資料的設計稿,或需要複雜互動邏輯的場景。使用方式很簡單,透過 npx 執行即可,需設定 DASHSCOPE_API_KEY。輸出的程式碼應經過格式化、語法檢查與建置驗證後再提交。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/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 值重新執行,並檢查產生的 import 語句。
產生的版面尺寸錯誤確認截圖匯出寬度與目標 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/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

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.

相關技能