← 返回 Skills 市场
laimiaohua

GI Vue Component Guide

作者 laimiaohua · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
253
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gi-vue-component-guide
功能描述
Design and implement Vue 3 components following best practices. Use when creating Vue components, defining props/emits, or when the user asks for Vue compone...
使用说明 (SKILL.md)

Vue 3 组件规范

按团队规范设计与实现 Vue 3 组件,适用于 Composition API + Ant Design 技术栈。

何时使用

  • 用户请求「写一个 Vue 组件」「设计组件结构」
  • 定义 Props、Emits、Slots
  • 使用 Composition API 组织逻辑
  • 与 Ant Design 组件集成

项目结构

src/
├── components/     # 可复用组件
├── views/          # 页面级组件
├── router/
├── services/
├── stores/
├── types/
└── utils/

组件设计原则

1. 命名

  • 组件文件:PascalCase,如 UserCard.vueDataTable.vue
  • 组件注册:与文件名一致
  • Props:camelCase,如 userNameisLoading

2. 单文件结构顺序

\x3Cscript setup lang="ts">
// 1. imports
// 2. props & emits 定义
// 3. 响应式状态
// 4. 计算属性
// 5. 方法
// 6. 生命周期 / watch
\x3C/script>

\x3Ctemplate>
  \x3C!-- 模板 -->
\x3C/template>

\x3Cstyle scoped>
/* 样式 */
\x3C/style>

3. Props 定义

interface Props {
  /** 用户 ID */
  userId: number
  /** 是否加载中 */
  loading?: boolean
  /** 自定义类名 */
  class?: string
}

const props = withDefaults(defineProps\x3CProps>(), {
  loading: false
})
  • 必填项不加 ?
  • 提供默认值用 withDefaults
  • 复杂类型从 types/ 导入

4. Emits 定义

const emit = defineEmits\x3C{
  (e: 'update', value: string): void
  (e: 'submit', payload: { id: number; name: string }): void
}>()

5. 与 Ant Design 集成

  • 表单:a-form + a-form-item,使用 v-modelv-decorator(视版本)
  • 表格:a-table,columns 用 defineColumns 或常量
  • 弹窗:a-modalv-model:open 控制显隐
  • 按钮:a-button,type 区分 primary/default/danger

6. 请求与状态

// 从 services 调用 API
import { getUserList } from '@/services/user'

const loading = ref(false)
const data = ref\x3CUser[]>([])

async function fetchData() {
  loading.value = true
  try {
    data.value = await getUserList(params)
  } finally {
    loading.value = false
  }
}

7. 类型定义

  • 组件 Props/Emits 的 payload 类型放在 types/ 或组件同目录
  • 使用 interfacetype,避免 any

示例模板

\x3Cscript setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import type { User } from '@/types/user'

interface Props {
  title?: string
}
const props = withDefaults(defineProps\x3CProps>(), { title: '默认标题' })

const emit = defineEmits\x3C{ (e: 'confirm', id: number): void }>()

const list = ref\x3CUser[]>([])
const loading = ref(false)

onMounted(() => {
  // 初始化
})
\x3C/script>

\x3Ctemplate>
  \x3Cdiv class="user-card">
    \x3Ca-spin :spinning="loading">
      \x3C!-- 内容 -->
    \x3C/a-spin>
  \x3C/div>
\x3C/template>

\x3Cstyle scoped>
.user-card { /* ... */ }
\x3C/style>

常见模式

  • 受控/非受控:优先受控(v-model),必要时支持非受控
  • 插槽:默认 slot + 具名 slot(如 headerfooter
  • 样式:优先 scoped,避免污染;使用 CSS 变量统一主题
安全使用建议
This skill is a static guide for writing Vue 3 components (Composition API + Ant Design). It does not install software or ask for secrets. Before using, ensure your project actually uses the stated stack (Vue 3, TypeScript conventions, Ant Design) and adapt any patterns to your team's linting/build rules and dependency versions. If you prefer guidance in another language or for a different UI library, look for a matching skill instead.
功能分析
Type: OpenClaw Skill Name: gi-vue-component-guide Version: 1.0.0 The skill bundle is a standard coding style guide for Vue 3 development using the Composition API and Ant Design. It contains only documentation and code templates (SKILL.md) intended to guide an AI agent in generating consistent frontend components, with no evidence of malicious intent, data exfiltration, or prompt injection.
能力评估
Purpose & Capability
The name/description (Vue 3 component guide) matches the SKILL.md content: guidance on Composition API, props/emits, project layout, and Ant Design integration. There are no unrelated requirements (no env vars, no binaries).
Instruction Scope
Instructions are purely prescriptive for component structure and patterns. They reference project paths (src/components, services, types) as expected for a coding style guide and do not instruct reading system files, accessing credentials, or sending data externally.
Install Mechanism
No install specification and no code files — the skill is instruction-only, so nothing is downloaded or written to disk.
Credentials
The skill requires no environment variables, credentials, or config paths. This is proportional for a documentation/style-guide skill.
Persistence & Privilege
always is false and the skill does not request elevated or persistent privileges. Normal autonomous invocation is allowed by platform default and is not a concern here given the skill's low surface area.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gi-vue-component-guide
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gi-vue-component-guide 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release. Gravitech Innovations.
元数据
Slug gi-vue-component-guide
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

GI Vue Component Guide 是什么?

Design and implement Vue 3 components following best practices. Use when creating Vue components, defining props/emits, or when the user asks for Vue compone... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 253 次。

如何安装 GI Vue Component Guide?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gi-vue-component-guide」即可一键安装,无需额外配置。

GI Vue Component Guide 是免费的吗?

是的,GI Vue Component Guide 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

GI Vue Component Guide 支持哪些平台?

GI Vue Component Guide 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 GI Vue Component Guide?

由 laimiaohua(@laimiaohua)开发并维护,当前版本 v1.0.0。

💬 留言讨论