mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 15:03:57 +08:00
feat: add queue management and terminal dashboard documentation in Chinese
- Introduced comprehensive documentation for the queue management feature, detailing its pain points, core functionalities, and component structure. - Added terminal dashboard documentation, highlighting its layout, core features, and usage examples. - Created an index page in Chinese for Claude Code Workflow, summarizing its purpose and core features, along with quick links to installation and guides.
This commit is contained in:
119
docs/zh-CN/components/ui/badge.md
Normal file
119
docs/zh-CN/components/ui/badge.md
Normal file
@@ -0,0 +1,119 @@
|
||||
---
|
||||
title: Badge 徽章
|
||||
description: 用于视觉分类的小型状态或标签组件
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Badge 徽章
|
||||
|
||||
## 概述
|
||||
|
||||
Badge 徽章组件用于以紧凑形式显示状态、类别或标签。它通常用于标签、状态指示器和计数。
|
||||
|
||||
## 语法演示
|
||||
|
||||
:::demo badge-variants
|
||||
展示所有可用的徽章变体,包括默认、次要、破坏性、轮廓、成功、警告、信息、审查和渐变样式
|
||||
:::
|
||||
|
||||
## 属性
|
||||
|
||||
<PropsTable :props="[
|
||||
{ name: 'variant', type: '\'default\' | \'secondary\' | \'destructive\' | \'outline\' | \'success\' | \'warning\' | \'info\' | \'review\' | \'gradient\'', required: false, default: '\'default\'', description: '视觉样式变体' },
|
||||
{ name: 'className', type: 'string', required: false, default: '-', description: '自定义 CSS 类名' },
|
||||
{ name: 'children', type: 'ReactNode', required: true, default: '-', description: '徽章内容' }
|
||||
]" />
|
||||
|
||||
## 变体说明
|
||||
|
||||
### Default(默认)
|
||||
|
||||
主题色背景的主要徽章。用于主要标签和类别。
|
||||
|
||||
### Secondary(次要)
|
||||
|
||||
次要信息的灰色徽章。
|
||||
|
||||
### Destructive(破坏性)
|
||||
|
||||
红色徽章,用于错误、危险状态或负面状态指示。
|
||||
|
||||
### Outline(轮廓)
|
||||
|
||||
只有文本和边框、无背景的徽章。用于微妙的标签。
|
||||
|
||||
### Success(成功)
|
||||
|
||||
绿色徽章,用于成功状态、完成的操作或正面状态指示。
|
||||
|
||||
### Warning(警告)
|
||||
|
||||
黄色/琥珀色徽章,用于警告、待处理状态或注意事项。
|
||||
|
||||
### Info(信息)
|
||||
|
||||
蓝色徽章,用于信息内容或中性状态。
|
||||
|
||||
### Review(审查)
|
||||
|
||||
紫色徽章,用于审查状态、待审查或反馈指示器。
|
||||
|
||||
### Gradient(渐变)
|
||||
|
||||
带品牌渐变背景的徽章,用于特色或突出显示的项目。
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础徽章
|
||||
|
||||
```vue
|
||||
<Badge>默认</Badge>
|
||||
```
|
||||
|
||||
### 状态指示器
|
||||
|
||||
```vue
|
||||
<Badge variant="success">活跃</Badge>
|
||||
<Badge variant="warning">待处理</Badge>
|
||||
<Badge variant="destructive">失败</Badge>
|
||||
<Badge variant="info">草稿</Badge>
|
||||
```
|
||||
|
||||
### 计数徽章
|
||||
|
||||
```vue
|
||||
<div class="relative">
|
||||
<Bell />
|
||||
<Badge variant="destructive" class="absolute -top-2 -right-2 h-5 w-5 rounded-full p-0 flex items-center justify-center text-xs">
|
||||
3
|
||||
</Badge>
|
||||
</div>
|
||||
```
|
||||
|
||||
### 分类标签
|
||||
|
||||
```vue
|
||||
<div class="flex gap-2">
|
||||
<Badge variant="outline">React</Badge>
|
||||
<Badge variant="outline">TypeScript</Badge>
|
||||
<Badge variant="outline">Tailwind</Badge>
|
||||
</div>
|
||||
```
|
||||
|
||||
### 审查状态
|
||||
|
||||
```vue
|
||||
<Badge variant="review">审查中</Badge>
|
||||
```
|
||||
|
||||
### 渐变徽章
|
||||
|
||||
```vue
|
||||
<Badge variant="gradient">特色</Badge>
|
||||
```
|
||||
|
||||
## 相关组件
|
||||
|
||||
- [Card 卡片](/zh-CN/components/ui/card)
|
||||
- [Button 按钮](/zh-CN/components/ui/button)
|
||||
- [Avatar 头像](/zh-CN/components/ui/avatar)
|
||||
80
docs/zh-CN/components/ui/button.md
Normal file
80
docs/zh-CN/components/ui/button.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
title: Button 按钮
|
||||
description: 按钮组件用于触发操作或提交表单
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Button 按钮
|
||||
|
||||
## 概述
|
||||
|
||||
按钮是最常用的交互元素之一,用于触发操作、提交表单或导航到其他页面。
|
||||
|
||||
## 语法演示
|
||||
|
||||
:::demo button-variants
|
||||
展示所有视觉变体的按钮组件
|
||||
:::
|
||||
|
||||
## 属性
|
||||
|
||||
<PropsTable :props="[
|
||||
{ name: 'variant', type: '\'default\' | \'destructive\' | \'outline\' | \'secondary\' | \'ghost\' | \'link\' | \'gradient\' | \'gradientPrimary\'', required: false, default: '\'default\'', description: '按钮的视觉变体' },
|
||||
{ name: 'size', type: '\'default\' | \'sm\' | \'lg\' | \'icon\'', required: false, default: '\'default\'', description: '按钮的大小' },
|
||||
{ name: 'asChild', type: 'boolean', required: false, default: 'false', description: '是否将 props 与子元素合并(用于 Radix UI 组合)' },
|
||||
{ name: 'disabled', type: 'boolean', required: false, default: 'false', description: '是否禁用按钮' },
|
||||
{ name: 'onClick', type: '() => void', required: false, default: '-', description: '点击事件回调函数' },
|
||||
{ name: 'className', type: 'string', required: false, default: '-', description: '自定义 CSS 类名' },
|
||||
{ name: 'children', type: 'ReactNode', required: true, default: '-', description: '按钮内容' }
|
||||
]" />
|
||||
|
||||
## 变体说明
|
||||
|
||||
### Default(默认)
|
||||
|
||||
默认按钮用于主要的操作场景。
|
||||
|
||||
### Destructive(破坏性)
|
||||
|
||||
破坏性按钮用于删除、移除等不可逆的操作。
|
||||
|
||||
### Outline(轮廓)
|
||||
|
||||
轮廓按钮用于次要操作,视觉上更轻量。
|
||||
|
||||
### Secondary(次要)
|
||||
|
||||
次要按钮用于辅助操作。
|
||||
|
||||
### Ghost(幽灵)
|
||||
|
||||
幽灵按钮没有边框,视觉上最轻量。
|
||||
|
||||
### Link(链接)
|
||||
|
||||
链接按钮看起来像链接,但具有按钮的交互行为。
|
||||
|
||||
### Gradient(渐变)
|
||||
|
||||
渐变按钮使用品牌渐变色,悬停时带有发光效果。
|
||||
|
||||
### Gradient Primary(主色渐变)
|
||||
|
||||
主色渐变按钮使用主题主色渐变,悬停时带有增强的发光效果。
|
||||
|
||||
## 使用场景
|
||||
|
||||
| 场景 | 推荐变体 |
|
||||
|------|----------|
|
||||
| 主要操作(提交、保存) | default, gradientPrimary |
|
||||
| 危险操作(删除、移除) | destructive |
|
||||
| 次要操作 | outline, secondary |
|
||||
| 取消操作 | ghost, outline |
|
||||
| 导航链接 | link |
|
||||
| 促销/特色 CTA | gradient |
|
||||
|
||||
## 相关组件
|
||||
|
||||
- [Input 输入框](/zh-CN/components/ui/input)
|
||||
- [Select 选择器](/zh-CN/components/ui/select)
|
||||
- [Dialog 对话框](/zh-CN/components/ui/dialog)
|
||||
107
docs/zh-CN/components/ui/card.md
Normal file
107
docs/zh-CN/components/ui/card.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
title: Card 卡片
|
||||
description: 用于分组相关内容的容器组件
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Card 卡片
|
||||
|
||||
## 概述
|
||||
|
||||
卡片组件是一个通用的容器,用于分组相关的内容和操作。它由多个子组件组成,协同工作以创建连贯的卡片布局。
|
||||
|
||||
## 语法演示
|
||||
|
||||
:::demo card-variants
|
||||
展示不同的卡片布局,包括页眉、内容、页脚和渐变边框变体
|
||||
:::
|
||||
|
||||
## 组件
|
||||
|
||||
卡片组件包含以下子组件:
|
||||
|
||||
| 组件 | 用途 |
|
||||
|------|------|
|
||||
| `Card` | 带有边框和背景的主容器 |
|
||||
| `CardHeader` | 带有内边距的页眉部分 |
|
||||
| `CardTitle` | 标题元素 |
|
||||
| `CardDescription` | 带有次要颜色的描述文本 |
|
||||
| `CardContent` | 带有顶部内边距的内容区域 |
|
||||
| `CardFooter` | 用于操作的页脚部分 |
|
||||
| `CardGradientBorder` | 带有渐变边框的卡片 |
|
||||
|
||||
## 属性
|
||||
|
||||
所有 Card 组件接受标准 HTML div 属性:
|
||||
|
||||
| 组件 | 属性 |
|
||||
|------|------|
|
||||
| `Card` | `className?: string` |
|
||||
| `CardHeader` | `className?: string` |
|
||||
| `CardTitle` | `className?: string`, `children?: ReactNode` |
|
||||
| `CardDescription` | `className?: string`, `children?: ReactNode` |
|
||||
| `CardContent` | `className?: string` |
|
||||
| `CardFooter` | `className?: string` |
|
||||
| `CardGradientBorder` | `className?: string` |
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础卡片
|
||||
|
||||
```vue
|
||||
<Card>
|
||||
<CardContent>
|
||||
<p>这是一个带有内容的基础卡片。</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
```
|
||||
|
||||
### 带页眉的卡片
|
||||
|
||||
```vue
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>卡片标题</CardTitle>
|
||||
<CardDescription>卡片描述放在这里</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>卡片内容放在这里。</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
```
|
||||
|
||||
### 带页脚的完整卡片
|
||||
|
||||
```vue
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>项目设置</CardTitle>
|
||||
<CardDescription>管理您的项目配置</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>配置您的项目设置和偏好。</p>
|
||||
</CardContent>
|
||||
<CardFooter>
|
||||
<Button>保存更改</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
```
|
||||
|
||||
### 带渐变边框的卡片
|
||||
|
||||
```vue
|
||||
<CardGradientBorder>
|
||||
<CardHeader>
|
||||
<CardTitle>特色卡片</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p>此卡片具有渐变边框效果。</p>
|
||||
</CardContent>
|
||||
</CardGradientBorder>
|
||||
```
|
||||
|
||||
## 相关组件
|
||||
|
||||
- [Button 按钮](/zh-CN/components/ui/button)
|
||||
- [Badge 徽章](/zh-CN/components/ui/badge)
|
||||
- [Separator 分隔线](/zh-CN/components/ui/separator)
|
||||
120
docs/zh-CN/components/ui/checkbox.md
Normal file
120
docs/zh-CN/components/ui/checkbox.md
Normal file
@@ -0,0 +1,120 @@
|
||||
---
|
||||
title: Checkbox 复选框
|
||||
description: 用于二元选择的复选框组件
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Checkbox 复选框
|
||||
|
||||
## 概述
|
||||
|
||||
Checkbox 复选框组件允许用户从一组选项中选择一个或多个选项。基于 Radix UI Checkbox Primitive 构建,提供完整的无障碍支持,包括键盘导航。
|
||||
|
||||
## 语法演示
|
||||
|
||||
:::demo checkbox-variants
|
||||
展示不同的复选框状态,包括选中、未选中、半选和禁用状态
|
||||
:::
|
||||
|
||||
## 属性
|
||||
|
||||
<PropsTable :props="[
|
||||
{ name: 'checked', type: 'boolean | \'indeterminate\'', required: false, default: 'false', description: '是否选中复选框' },
|
||||
{ name: 'defaultChecked', type: 'boolean', required: false, default: 'false', description: '初始选中状态(非受控)' },
|
||||
{ name: 'onCheckedChange', type: '(checked: boolean) => void', required: false, default: '-', description: '选中状态变化时的回调函数' },
|
||||
{ name: 'disabled', type: 'boolean', required: false, default: 'false', description: '是否禁用复选框' },
|
||||
{ name: 'required', type: 'boolean', required: false, default: 'false', description: '是否为必填项' },
|
||||
{ name: 'name', type: 'string', required: false, default: '-', description: '表单输入名称' },
|
||||
{ name: 'value', type: 'string', required: false, default: '-', description: '表单输入值' },
|
||||
{ name: 'className', type: 'string', required: false, default: '-', description: '自定义 CSS 类名' }
|
||||
]" />
|
||||
|
||||
## 状态说明
|
||||
|
||||
### Unchecked(未选中)
|
||||
|
||||
复选框未被选择时的默认状态。
|
||||
|
||||
### Checked(已选中)
|
||||
|
||||
复选框被选择时显示勾选图标。
|
||||
|
||||
### Indeterminate(半选)
|
||||
|
||||
混合状态(部分选择),通常用于父级复选框,当部分但不是全部子项被选中时使用。
|
||||
|
||||
### Disabled(禁用)
|
||||
|
||||
禁用的复选框不可交互,并以降低的透明度显示。
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础复选框
|
||||
|
||||
```vue
|
||||
<Checkbox />
|
||||
```
|
||||
|
||||
### 带标签的复选框
|
||||
|
||||
```vue
|
||||
<div class="flex items-center space-x-2">
|
||||
<Checkbox id="terms" />
|
||||
<label for="terms">我同意条款和条件</label>
|
||||
</div>
|
||||
```
|
||||
|
||||
### 受控复选框
|
||||
|
||||
```vue
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const checked = ref(false)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Checkbox v-model:checked="checked" />
|
||||
<span>{{ checked ? '已选中' : '未选中' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
### 半选状态
|
||||
|
||||
```vue
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const state = ref('indeterminate')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Checkbox :checked="state" />
|
||||
</template>
|
||||
```
|
||||
|
||||
### 表单集成
|
||||
|
||||
```vue
|
||||
<form @submit="handleSubmit">
|
||||
<div class="space-y-2">
|
||||
<div class="flex items-center space-x-2">
|
||||
<Checkbox id="newsletter" name="newsletter" value="yes" />
|
||||
<label for="newsletter">订阅新闻通讯</label>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Checkbox id="updates" name="updates" value="yes" />
|
||||
<label for="updates">接收产品更新</label>
|
||||
</div>
|
||||
</div>
|
||||
<Button type="submit" class="mt-4">提交</Button>
|
||||
</form>
|
||||
```
|
||||
|
||||
## 相关组件
|
||||
|
||||
- [Input 输入框](/zh-CN/components/ui/input)
|
||||
- [Select 选择器](/zh-CN/components/ui/select)
|
||||
- [Radio Group 单选框组](/zh-CN/components/ui/radio-group)
|
||||
118
docs/zh-CN/components/ui/input.md
Normal file
118
docs/zh-CN/components/ui/input.md
Normal file
@@ -0,0 +1,118 @@
|
||||
---
|
||||
title: Input 输入框
|
||||
description: 用于表单和用户输入的文本输入组件
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Input 输入框
|
||||
|
||||
## 概述
|
||||
|
||||
输入框组件提供了一个样式化的文本输入字段,扩展了原生 HTML input 元素,具有一致的样式和错误状态支持。
|
||||
|
||||
## 语法演示
|
||||
|
||||
:::demo input-variants
|
||||
展示所有输入框状态,包括默认、错误和禁用
|
||||
:::
|
||||
|
||||
## 属性
|
||||
|
||||
<PropsTable :props="[
|
||||
{ name: 'type', type: 'string', required: false, default: '\'text\'', description: 'HTML input 类型(text、password、email、number 等)' },
|
||||
{ name: 'error', type: 'boolean', required: false, default: 'false', description: '输入框是否处于错误状态(显示破坏性边框)' },
|
||||
{ name: 'disabled', type: 'boolean', required: false, default: 'false', description: '是否禁用输入框' },
|
||||
{ name: 'placeholder', type: 'string', required: false, default: '-', description: '输入框为空时显示的占位符文本' },
|
||||
{ name: 'value', type: 'string | number', required: false, default: '-', description: '受控输入框的值' },
|
||||
{ name: 'defaultValue', type: 'string | number', required: false, default: '-', description: '非受控输入框的默认值' },
|
||||
{ name: 'onChange', type: '(event: ChangeEvent) => void', required: false, default: '-', description: '变更事件回调函数' },
|
||||
{ name: 'className', type: 'string', required: false, default: '-', description: '自定义 CSS 类名' }
|
||||
]" />
|
||||
|
||||
## 状态
|
||||
|
||||
### Default(默认)
|
||||
|
||||
带有边框和焦点环的标准输入框。
|
||||
|
||||
### Error(错误)
|
||||
|
||||
错误状态,显示破坏性边框颜色。将 `error` 属性设置为 `true`。
|
||||
|
||||
### Disabled(禁用)
|
||||
|
||||
禁用状态,透明度降低。将 `disabled` 属性设置为 `true`。
|
||||
|
||||
### Focus(聚焦)
|
||||
|
||||
聚焦状态,带有环形轮廓。
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础输入框
|
||||
|
||||
```tsx
|
||||
import { Input } from '@/components/ui/Input'
|
||||
|
||||
function Example() {
|
||||
return <input type="text" placeholder="输入文本..." />
|
||||
}
|
||||
```
|
||||
|
||||
### 受控输入框
|
||||
|
||||
```tsx
|
||||
import { Input } from '@/components/ui/Input'
|
||||
|
||||
function Example() {
|
||||
const [value, setValue] = useState('')
|
||||
|
||||
return (
|
||||
<Input
|
||||
type="text"
|
||||
value={value}
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
placeholder="输入文本..."
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 错误状态输入框
|
||||
|
||||
```tsx
|
||||
import { Input } from '@/components/ui/Input'
|
||||
|
||||
function Example() {
|
||||
return (
|
||||
<Input
|
||||
type="text"
|
||||
error
|
||||
placeholder="无效输入..."
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 密码输入框
|
||||
|
||||
```tsx
|
||||
import { Input } from '@/components/ui/Input'
|
||||
|
||||
function Example() {
|
||||
return <Input type="password" placeholder="输入密码..." />
|
||||
}
|
||||
```
|
||||
|
||||
## 无障碍访问
|
||||
|
||||
- **键盘导航**:完全支持原生键盘操作
|
||||
- **ARIA 属性**:支持所有标准输入框 ARIA 属性
|
||||
- **焦点可见**:为键盘导航提供清晰的焦点指示器
|
||||
- **错误状态**:错误状态的视觉指示(与 `aria-invalid` 和 `aria-describedby` 配合使用)
|
||||
|
||||
## 相关组件
|
||||
|
||||
- [Button 按钮](/zh-CN/components/ui/button)
|
||||
- [Select 选择器](/zh-CN/components/ui/select)
|
||||
- [Checkbox 复选框](/zh-CN/components/ui/checkbox)
|
||||
127
docs/zh-CN/components/ui/select.md
Normal file
127
docs/zh-CN/components/ui/select.md
Normal file
@@ -0,0 +1,127 @@
|
||||
---
|
||||
title: Select 选择器
|
||||
description: 用于从选项列表中选择值的下拉选择组件
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Select 选择器
|
||||
|
||||
## 概述
|
||||
|
||||
Select 选择器组件允许用户从选项列表中选择单个值。基于 Radix UI Select Primitive 构建,提供开箱即用的无障碍支持和键盘导航。
|
||||
|
||||
## 语法演示
|
||||
|
||||
:::demo select-variants
|
||||
展示不同的选择器配置,包括基础用法、带标签和带分隔线的示例
|
||||
:::
|
||||
|
||||
## 子组件
|
||||
|
||||
Select 选择器组件包含以下子组件:
|
||||
|
||||
| 组件 | 用途 |
|
||||
|------|------|
|
||||
| `Select` | 管理状态的根组件 |
|
||||
| `SelectTrigger` | 打开下拉菜单的按钮 |
|
||||
| `SelectValue` | 显示选中的值 |
|
||||
| `SelectContent` | 下拉菜单内容容器 |
|
||||
| `SelectItem` | 单个可选项 |
|
||||
| `SelectLabel` | 用于分组的不可交互标签 |
|
||||
| `SelectGroup` | 将项目分组 |
|
||||
| `SelectSeparator` | 项目之间的视觉分隔线 |
|
||||
| `SelectScrollUpButton` | 长列表的向上滚动按钮 |
|
||||
| `SelectScrollDownButton` | 长列表的向下滚动按钮 |
|
||||
|
||||
## 属性
|
||||
|
||||
### Select 根组件
|
||||
|
||||
| 属性 | 类型 | 默认值 | 描述 |
|
||||
|------|------|--------|------|
|
||||
| `value` | `string` | - | 当前选中的值(受控) |
|
||||
| `defaultValue` | `string` | - | 默认选中的值 |
|
||||
| `onValueChange` | `(value: string) => void` | - | 值变化时的回调函数 |
|
||||
| `disabled` | `boolean` | `false` | 是否禁用选择器 |
|
||||
| `required` | `boolean` | `false` | 是否必填 |
|
||||
| `name` | `string` | - | 表单输入名称 |
|
||||
|
||||
### SelectTrigger
|
||||
|
||||
| 属性 | 类型 | 默认值 | 描述 |
|
||||
|------|------|--------|------|
|
||||
| `className` | `string` | - | 自定义 CSS 类名 |
|
||||
|
||||
### SelectItem
|
||||
|
||||
| 属性 | 类型 | 默认值 | 描述 |
|
||||
|------|------|--------|------|
|
||||
| `value` | `string` | - | 选项值 |
|
||||
| `disabled` | `boolean` | `false` | 是否禁用该选项 |
|
||||
| `className` | `string` | - | 自定义 CSS 类名 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础选择器
|
||||
|
||||
```vue
|
||||
<Select>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="请选择一个选项" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="option1">选项 1</SelectItem>
|
||||
<SelectItem value="option2">选项 2</SelectItem>
|
||||
<SelectItem value="option3">选项 3</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
```
|
||||
|
||||
### 带标签和分组
|
||||
|
||||
```vue
|
||||
<Select>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="选择水果" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectLabel>水果</SelectLabel>
|
||||
<SelectItem value="apple">苹果</SelectItem>
|
||||
<SelectItem value="banana">香蕉</SelectItem>
|
||||
<SelectItem value="orange">橙子</SelectItem>
|
||||
<SelectSeparator />
|
||||
<SelectLabel>蔬菜</SelectLabel>
|
||||
<SelectItem value="carrot">胡萝卜</SelectItem>
|
||||
<SelectItem value="broccoli">西兰花</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
```
|
||||
|
||||
### 受控选择器
|
||||
|
||||
```vue
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const selectedValue = ref('')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Select v-model="selectedValue">
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="请选择..." />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="a">选项 A</SelectItem>
|
||||
<SelectItem value="b">选项 B</SelectItem>
|
||||
<SelectItem value="c">选项 C</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</template>
|
||||
```
|
||||
|
||||
## 相关组件
|
||||
|
||||
- [Input 输入框](/zh-CN/components/ui/input)
|
||||
- [Checkbox 复选框](/zh-CN/components/ui/checkbox)
|
||||
- [Button 按钮](/zh-CN/components/ui/button)
|
||||
Reference in New Issue
Block a user