40 lines
940 B
Plaintext
40 lines
940 B
Plaintext
---
|
|
title: 项目配置
|
|
description: 导入全局样式,并从显式组件子路径开始使用。
|
|
order: 10
|
|
toc:
|
|
- id: import-styles
|
|
title: 导入样式
|
|
- id: import-a-component
|
|
title: 导入组件
|
|
- id: entry-points
|
|
title: 包入口
|
|
---
|
|
|
|
## 导入样式 {#import-styles}
|
|
|
|
在应用入口中导入一次全局样式:
|
|
|
|
```ts
|
|
import "@workspace/ui/globals.css"
|
|
```
|
|
|
|
它提供组件所需的共享 Tailwind 层、设计变量、字体配置和工具类。
|
|
|
|
## 导入组件 {#import-a-component}
|
|
|
|
```tsx
|
|
import { Button } from "@workspace/ui/components/button"
|
|
|
|
export function SaveButton() {
|
|
return <Button>保存</Button>
|
|
}
|
|
```
|
|
|
|
## 包入口 {#entry-points}
|
|
|
|
- `@workspace/ui/components/*` 导出单个组件模块。
|
|
- `@workspace/ui/hooks/*` 导出可复用的交互和媒体查询状态。
|
|
- `@workspace/ui/lib/utils` 导出共享的类名组合工具。
|
|
- `@workspace/ui/locales/*` 导出指定语言的词典。
|