Files
heroui-vue/apps/docs/guide.md
T

66 lines
1.5 KiB
Markdown

---
title: 安装
description: 在 Vue 项目中开始使用 HeroUI Vue
---
## 本地开发
包尚未发布,目前通过独立工作区开发和使用。
```sh
pnpm install
pnpm build
pnpm dev:docs
```
## 使用组件
```vue
<script setup lang="ts">
import { Button } from "@heroui-vue/components";
import "@heroui-vue/styles/css";
</script>
<template>
<Button>点我</Button>
</template>
```
## 图标
文档示例统一使用 [Tabler Icons 官方 Vue 包](https://github.com/tabler/tabler-icons/tree/main/packages/icons-vue),按需导入,不需要在线请求图标。
```sh
pnpm add @tabler/icons-vue
```
```vue
<script setup lang="ts">
import { IconSearch } from "@tabler/icons-vue";
import { Button } from "@heroui-vue/components";
</script>
<template>
<Button>
<IconSearch aria-hidden="true" />
搜索
</Button>
</template>
```
纯图标按钮必须提供 `aria-label`。图标库是演示应用依赖,组件库通过插槽接受任意图标,不强制消费者安装 Tabler。
## 样式入口
样式包使用 Tailwind CSS 4 编译基线 CSS,向消费者提供预编译 CSS。消费者不需要安装 Tailwind;自定义工具类需要在自己的应用中配置 Tailwind。
## 开发命令
| 命令 | 功能 |
| -------------- | --------------- |
| pnpm dev | 文档开发站 |
| pnpm dev:docs | 文档开发站 |
| pnpm build | 库与样式构建 |
| pnpm typecheck | Vue 类型检查 |
| pnpm test | 行为与 SSR 测试 |