lucky-ui-docs
用于为 lucky-ui 组件库编写、修改或补充 VitePress 文档。包括新组件文档、API 表格、使用示例、Demo 演示页等。
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
用于为 lucky-ui 组件库编写、修改或补充 VitePress 文档。包括新组件文档、API 表格、使用示例、Demo 演示页等。
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Use when debugging or verifying WeChat Mini Program UI issues in this repo. Prioritize WeChat DevTools CLI plus miniprogram-automator background inspection of routes, WXML, element offset/size, computed styles, and console output; refresh phone preview with auto-preview after fixes.
用于在 lucky-ui UniApp 多端组件库中新增、修改或调试组件。当用户需要:新建组件、修改现有组件逻辑/样式/props、调试组件问题、或为组件添加新功能时,必须使用本 skill。
用于在 lucky-ui 中添加、修改或管理图标。包括新增 SVG 图标到图标集、重建图标字体、查询现有图标命名、在组件中正确使用 lk-icon 组件。
用于定制、修改或扩展 lucky-ui 的主题系统,包括品牌色替换、亮暗模式配置、CSS 变量新增、组件级主题变量覆盖、字体/圆角/间距等设计 token 调整。
Automate browser interactions, test web pages and work with Playwright tests.
Runtime Automation Probe: 基于 Playwright / miniprogram-automator 的跨端 UI 运行态探针。必须用于用户提及抓取 H5、抓取h5、H5运行态、抓取微信小程序、微信小程序运行态、小程序运行态、抓 DOM、抓 WXML、元素标签、元素结构、样式、尺寸、offset、size、style、交互结果、跨端 UI 对比、运行态回归等场景。
| name | lucky-ui-docs |
| description | 用于为 lucky-ui 组件库编写、修改或补充 VitePress 文档。包括新组件文档、API 表格、使用示例、Demo 演示页等。 |
docs/src/pages/ (UniApp H5 页面)pnpm run docs:dev(端口 4173)docs/
├── .vitepress/
│ ├── config.ts # VitePress 配置(导航、侧边栏)
│ └── theme/ # 自定义主题
├── components/ # 各组件文档
│ ├── button.md
│ ├── tabs.md
│ └── ...
├── guide/ # 指南文档
│ ├── quickstart.md
│ ├── theme.md
│ └── ...
└── index.md # 首页
创建 docs/components/{name}.md:
# ComponentName 组件名
> 一句话描述组件的用途和适用场景。
## 基础用法
<demo-preview path="../../src/pages/component-name/index" />
\`\`\`vue
<template>
<lk-component-name :prop-a="value">
内容
</lk-component-name>
</template>
\`\`\`
## 变体示例
### 尺寸
<demo-preview path="..." />
\`\`\`vue
<lk-component-name size="sm">小</lk-component-name>
<lk-component-name size="md">中</lk-component-name>
<lk-component-name size="lg">大</lk-component-name>
\`\`\`
### 状态
\`\`\`vue
<lk-component-name disabled>禁用</lk-component-name>
<lk-component-name loading>加载中</lk-component-name>
\`\`\`
## API
### Props
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------|------|------|--------|--------|
| variant | 样式变体 | `string` | `primary / secondary / danger` | `primary` |
| size | 尺寸 | `string` | `sm / md / lg` | `md` |
| disabled | 是否禁用 | `boolean` | — | `false` |
| loading | 是否加载中 | `boolean` | — | `false` |
| customClass | 自定义类名 | `string / object / array` | — | — |
| customStyle | 自定义样式 | `string / object` | — | — |
### Emits
| 事件名 | 说明 | 回调参数 |
|--------|------|----------|
| click | 点击时触发 | `(event: Event)` |
| change | 值变化时触发 | `(value: string)` |
### Slots
| 插槽名 | 说明 | 作用域参数 |
|--------|------|-----------|
| default | 默认内容 | — |
| prefix | 前置内容 | — |
| suffix | 后置内容 | — |
| title | `#title` 标题 | — |
### Methods(通过 ref 调用)
| 方法名 | 说明 | 参数 |
|--------|------|------|
| open() | 打开 | — |
| close() | 关闭 | — |
| toggle() | 切换 | — |
## 主题定制
通过 CSS 变量覆盖组件样式:
| CSS 变量 | 说明 | 默认值 |
|----------|------|--------|
| `--lk-btn-height` | 按钮高度 | `var(--lk-control-height-md)` |
| `--lk-btn-radius` | 圆角 | `var(--lk-radius-md)` |
## 注意事项
> [!WARNING]
> 在小程序中使用时,请注意 xxx 限制。
> [!TIP]
> 建议在 xxx 场景下使用 yyy 替代方案。
编辑 docs/.vitepress/config.ts:
export default defineConfig({
themeConfig: {
sidebar: {
'/components/': [
{
text: '基础组件',
items: [
{ text: 'Button 按钮', link: '/components/button' },
// 新增:
{ text: 'MyComponent 组件名', link: '/components/my-component' },
]
},
{
text: '表单组件',
items: [/* ... */]
},
]
}
}
})
演示页位于 src/pages/{component-name}/index.vue,是组件在 UniApp 中的实际运行示例。
<script setup lang="ts">
import { ref } from 'vue';
import { DemoBlock } from '@/uni_modules/lucky-ui/components';
const value = ref('');
const show = ref(false);
</script>
<template>
<view class="page">
<!-- 基础用法 -->
<demo-block title="基础用法">
<lk-component-name :model-value="value" @change="v => value = v" />
</demo-block>
<!-- 变体 -->
<demo-block title="变体类型">
<lk-component-name variant="primary">主要</lk-component-name>
<lk-component-name variant="secondary">次要</lk-component-name>
</demo-block>
<!-- 禁用状态 -->
<demo-block title="禁用状态">
<lk-component-name disabled>禁用</lk-component-name>
</demo-block>
</view>
</template>
<style lang="scss" scoped>
.page {
padding: var(--lk-spacing-md);
background: var(--lk-bg-page);
min-height: 100vh;
}
</style>
demo-block 是内置的演示容器组件:
| Prop | 类型 | 说明 |
|---|---|---|
title | String | 示例标题 |
desc | String | 描述文字(可选) |
编辑 src/pages.json:
{
"pages": [
{
"path": "pages/my-component/index",
"style": {
"navigationBarTitleText": "MyComponent 组件名"
}
}
]
}
支持语言:vue, typescript, javascript, scss, bash, json
::: tip 提示
这是一条提示信息
:::
::: warning 注意
这是一条警告信息
:::
::: danger 危险
这是一条危险提示
:::
::: details 展开查看
折叠的内容
:::
modelValue)`string`)/ 分隔(primary / secondary)—# 启动文档开发服务(端口 4173)
pnpm run docs:dev
# 构建文档
pnpm run docs:build
# 预览构建产物
pnpm run docs:preview