File tree Expand file tree Collapse file tree 15 files changed +49
-63
lines changed Expand file tree Collapse file tree 15 files changed +49
-63
lines changed Original file line number Diff line number Diff line change 1
- - [ ] 修复ui组件类型提示问题
2
1
- [ ] 添加 utils 包测试用例(集成jest/vitest)
3
2
- [ ] docs文档添加“更多-更新日志”,changeset管理
Original file line number Diff line number Diff line change @@ -37,15 +37,18 @@ bun add @mylib/ui @mylib/utils @mylib/hooks
37
37
### UI Components
38
38
39
39
``` ts
40
+ // Global import
40
41
import { createApp } from ' vue' ;
41
42
import UI from ' @mylib/ui' ;
42
- import ' @mylib/ui/dist/ style.css' ;
43
+ import ' @mylib/ui/style.css' ;
43
44
const app = createApp (App );
44
45
app .use (UI );
46
+ // You also need to add the following configuration in tsconfig.json to get type hints:
47
+ // "types": ["@mylib/ui/global.d.ts"]
45
48
46
49
// On-demand import
47
50
import { Button } from ' @mylib/ui' ;
48
- import ' @mylib/ui/dist/ style.css' ;
51
+ import ' @mylib/ui/style.css' ;
49
52
const app = createApp (App );
50
53
app .use (Button );
51
54
```
Original file line number Diff line number Diff line change @@ -6,10 +6,9 @@ Basic button component.
6
6
7
7
<demo vue =" ui/button/basic.vue " />
8
8
9
- | Property | Description | Type | Default |
10
- | --- | --- | --- | --- |
11
- | type | Button type | 'primary' \| 'success' \| 'warning' \| 'danger' \| 'info' | '' |
12
- | size | Button size | 'small' \| 'medium' \| 'large' | 'medium' |
13
- | disabled | Whether to disable the button | boolean | false |
14
- | plain | Whether to use plain style | boolean | false |
15
- | round | Whether to use rounded corners | boolean | false |
9
+ | Property | Description | Type | Default |
10
+ | -------- | ------------------------------ | --------------------------------------------------------- | -------- |
11
+ | type | Button type | 'primary' \| 'success' \| 'warning' \| 'danger' \| 'info' | '' |
12
+ | size | Button size | 'small' \| 'medium' \| 'large' | 'medium' |
13
+ | disabled | Whether to disable the button | boolean | false |
14
+ | round | Whether to use rounded corners | boolean | false |
Original file line number Diff line number Diff line change @@ -23,20 +23,3 @@ The dialog can be styled using the following class names:
23
23
- ` .v-dialog ` : Main dialog container.
24
24
- ` .v-dialog__overlay ` : Background overlay.
25
25
- ` .v-dialog__content ` : Dialog content area.
26
-
27
- ## Code Example
28
-
29
- ``` vue
30
- <template>
31
- <VDialog v-model:open="open">
32
- <div>Dialog content</div>
33
- </VDialog>
34
- <a-button @click="open = true">Open Dialog</a-button>
35
- </template>
36
-
37
- <script setup lang="ts">
38
- import { VDialog } from '@mylib/ui';
39
- import { ref } from 'vue';
40
- const open = ref(false);
41
- </script>
42
- ```
Original file line number Diff line number Diff line change @@ -37,11 +37,14 @@ bun add @mylib/ui @mylib/utils @mylib/hooks
37
37
### UI 组件
38
38
39
39
``` ts
40
+ // 全局引入
40
41
import { createApp } from ' vue' ;
41
42
import UI from ' @mylib/ui' ;
42
43
import ' @mylib/ui/style.css' ;
43
44
const app = createApp (App );
44
45
app .use (UI );
46
+ // tsconfig.json还需要添加以下配置以获得类型提示:
47
+ // "types": ["@mylib/ui/global.d.ts"]
45
48
46
49
// 按需引入
47
50
import { Button } from ' @mylib/ui' ;
Original file line number Diff line number Diff line change 11
11
| type | 按钮类型 | 'primary' \| 'success' \| 'warning' \| 'danger' \| 'info' | '' |
12
12
| size | 按钮大小 | 'small' \| 'medium' \| 'large' | 'medium' |
13
13
| disabled | 是否禁用 | boolean | false |
14
- | plain | 是否朴素 | boolean | false |
15
14
| round | 是否圆角 | boolean | false |
Original file line number Diff line number Diff line change 23
23
- ` .v-dialog ` : 主弹窗容器。
24
24
- ` .v-dialog__overlay ` : 背景遮罩。
25
25
- ` .v-dialog__content ` : 弹窗内容区域。
26
-
27
- ## 代码示例
28
-
29
- ``` vue
30
- <template>
31
- <VDialog v-model:open="open">
32
- <div>弹窗内容</div>
33
- </VDialog>
34
- <a-button @click="open = true">打开弹窗</a-button>
35
- </template>
36
-
37
- <script setup lang="ts">
38
- import { VDialog } from '@mylib/ui';
39
- import { ref } from 'vue';
40
- const open = ref(false);
41
- </script>
42
- ```
Original file line number Diff line number Diff line change 13
13
"import" : " ./dist/es/index.mjs" ,
14
14
"require" : " ./dist/lib/index.js"
15
15
},
16
- "./style.css" : " ./dist/style.css"
16
+ "./style.css" : " ./dist/style.css" ,
17
+ "./*" : " ./dist/*"
17
18
},
18
19
"files" : [
19
20
" dist"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // // For this project development
2
+ // import '@vue/runtime-core';
3
+
4
+ /**
5
+ * 给全局引入的UI组件类型提示:
6
+ * tsconfig.json需要添加以下配置:
7
+ * "types": ["vite/client", "@mylib/ui/global.d.ts"]
8
+ */
9
+ declare module '@vue/runtime-core' {
10
+ // GlobalComponents for Volar
11
+ export interface GlobalComponents {
12
+ VButton : ( typeof import ( '@mylib/ui' ) ) [ 'VButton' ] ;
13
+ VDialog : ( typeof import ( '@mylib/ui' ) ) [ 'VDialog' ] ;
14
+ }
15
+ }
16
+
17
+ export { } ;
You can’t perform that action at this time.
0 commit comments