Skip to content

Commit 81f0359

Browse files
committed
docs: 完善文档说明
1 parent 03f51dd commit 81f0359

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

README.md

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pnpm add vue @vueuse/core
3232

3333
# 开发依赖,以 Vite 为例
3434
pnpm add vue-component-type-helpers type-fest typescript vite @vitejs/plugin-vue -D
35-
3635
```
3736

3837
### 3. 配置构建工具 alias(以 Vite 为例)
@@ -74,8 +73,12 @@ export default defineConfig({
7473
}
7574
},
7675
"include": [
77-
"src",
78-
"compose-kit" // 确保 TS 能扫描到本库源码
76+
"src/**/*",
77+
"src/**/*.vue",
78+
79+
// 确保 TS 能扫描到本库源码
80+
"compose-kit/src/**/*",
81+
"compose-kit/src/**/*.vue"
7982
]
8083
}
8184
```
@@ -107,7 +110,7 @@ createApp(App).use((app) => {
107110

108111
### 三方组件库集成(可选)
109112

110-
本库不会自动安装或引入任何第三方组件库及其样式(例如 Element Plus)。如果你需要结合 UI 组件库使用本库提供的能力,可以参考下面以 Element Plus 为例的可选说明。
113+
本库不会自动安装或引入任何第三方组件库及其样式(例如 Element Plus)。如果你需要结合 UI 组件库使用本库提供的能力,可以参考下面以 Element Plus 为例的可选说明。如果在项目中完全不需要这类第三方集成,可以直接删除 `compose-kit/src/element-plus` 等对应目录,不会影响本库核心功能。
111114

112115
<details>
113116
<summary>以 Element Plus 为例的集成(点击展开)</summary>
@@ -122,7 +125,7 @@ createApp(App).use((app) => {
122125
```ts
123126
import 'element-plus/theme-chalk/index.css'
124127
```
125-
- 通过 `provideGlobalConfig` 配置与 Element Plus 相关的全局行为(需要先引入下方的类型扩展)
128+
- 通过 `provideGlobalConfig` 配置与 Element Plus 相关的全局行为:
126129

127130
```ts
128131
provideGlobalConfig({
@@ -132,26 +135,10 @@ provideGlobalConfig({
132135
})
133136
```
134137

135-
#### 类型扩展(推荐其一即可)
136-
137-
1. **在类型声明文件中使用 `/// <reference />` 指令**(推荐写在 `env.d.ts` 或单独的 `global.d.ts` 顶部):
138-
139-
```ts
140-
/// <reference types="@vue-spark/compose-kit/element-plus/global-config" />
141-
```
142-
143-
2. **`tsconfig.json` 中通过 `compilerOptions.types` 统一引入**(与现有类型配置合并):
144-
145-
```jsonc
146-
{
147-
"compilerOptions": {
148-
"types": [
149-
"vite/client",
150-
"@vue-spark/compose-kit/element-plus/global-config"
151-
]
152-
}
153-
}
154-
```
138+
- 在需要使用 Element Plus 组件的页面中引入:
139+
```ts
140+
import { ElTableSchemaColumns } from '@vue-spark/compose-kit/element-plus'
141+
```
155142

156143
</details>
157144

0 commit comments

Comments
 (0)