dpzvc3-ui 3.1.1 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dpzvc3.esm.js +25 -56
- package/dist/dpzvc3.esm.js.map +1 -1
- package/dist/dpzvc3.esm.min.js +1 -1
- package/dist/dpzvc3.esm.min.js.map +1 -1
- package/dist/dpzvc3.js +24 -54
- package/dist/dpzvc3.js.map +1 -1
- package/dist/dpzvc3.min.js +1 -1
- package/dist/dpzvc3.min.js.map +1 -1
- package/dist/types/components/{Prompt → prompt}/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +82 -115
- package/package.json +2 -2
- package/src/index.d.ts +131 -0
- package/src/index.ts +29 -66
- package/src/types/index.d.ts +33 -70
- package/tsconfig.build.json +3 -2
- package/tsconfig.json +3 -1
- /package/dist/types/components/{Prompt → prompt}/types.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACxC,KAAK,eAAe,GAChB,MAAM,GACN,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAC,CAAA;AAEvC,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IAClC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,WAAW,IAAI;KAC7C,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACvB,GAAG;IACA,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAID,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,GAAG,CAAC;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAC;CAEtB,GAAG,IAAI,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,116 +1,86 @@
|
|
|
1
1
|
// src/types/index.d.ts
|
|
2
2
|
|
|
3
3
|
/* ----------------------------------
|
|
4
|
-
* 1️⃣
|
|
4
|
+
* 1️⃣ 按需导出组件 & props(给 TS import 用)
|
|
5
5
|
* ---------------------------------- */
|
|
6
|
-
export { default as Badge } from '
|
|
7
|
-
export type { BadgeProps } from '
|
|
8
|
-
export { default as Popup } from '../components/popup'
|
|
9
|
-
export type { PopupProps } from '../components/popup/types'
|
|
10
|
-
export { default as ActionSheet } from '../components/actionSheet'
|
|
11
|
-
export type { ActionSheetProps } from '../components/actionSheet/types'
|
|
6
|
+
export { default as Badge } from './components/badge'
|
|
7
|
+
export type { BadgeProps } from './components/badge/types'
|
|
12
8
|
|
|
13
|
-
export { default as
|
|
14
|
-
export type {
|
|
9
|
+
export { default as Popup } from './components/popup'
|
|
10
|
+
export type { PopupProps } from './components/popup/types'
|
|
15
11
|
|
|
16
|
-
export { default as
|
|
17
|
-
export type {
|
|
12
|
+
export { default as ActionSheet } from './components/actionSheet'
|
|
13
|
+
export type { ActionSheetProps } from './components/actionSheet/types'
|
|
18
14
|
|
|
19
|
-
export { default as
|
|
20
|
-
export type {
|
|
15
|
+
export { default as Card } from './components/card'
|
|
16
|
+
export type { CardProps } from './components/card/types'
|
|
21
17
|
|
|
22
|
-
export { default as
|
|
23
|
-
export type {
|
|
18
|
+
export { default as Rater } from './components/rater'
|
|
19
|
+
export type { RaterProps } from './components/rater/types'
|
|
24
20
|
|
|
25
|
-
export { default as
|
|
26
|
-
export type {
|
|
21
|
+
export { default as Cell } from './components/cell'
|
|
22
|
+
export type { CellProps } from './components/cell/types'
|
|
27
23
|
|
|
28
|
-
export { default as
|
|
29
|
-
export type {
|
|
24
|
+
export { default as CellSwipe } from './components/cellSwipe'
|
|
25
|
+
export type { CellSwipeProps } from './components/cellSwipe/types'
|
|
30
26
|
|
|
31
|
-
export { default as
|
|
32
|
-
export type {
|
|
27
|
+
export { default as DpHeader } from './components/header'
|
|
28
|
+
export type { HeaderProps } from './components/header/types'
|
|
33
29
|
|
|
34
|
-
export { default as
|
|
35
|
-
export type {
|
|
30
|
+
export { default as Spinner } from './components/spinner'
|
|
31
|
+
export type { SpinnerProps } from './components/spinner/types'
|
|
36
32
|
|
|
37
|
-
export { default as
|
|
38
|
-
export type {
|
|
33
|
+
export { default as Swipe } from './components/swipe'
|
|
34
|
+
export type { SwipeProps } from './components/swipe/types'
|
|
39
35
|
|
|
40
|
-
export { default as
|
|
41
|
-
export type {
|
|
36
|
+
export { default as DpButton } from './components/button'
|
|
37
|
+
export type { ButtonProps } from './components/button/types'
|
|
42
38
|
|
|
43
|
-
export { default as
|
|
44
|
-
export type {
|
|
39
|
+
export { default as Picker } from './components/picker'
|
|
40
|
+
export type { PickerProps } from './components/picker/types'
|
|
45
41
|
|
|
46
|
-
export { default as
|
|
47
|
-
export type {
|
|
42
|
+
export { default as SwitchBar } from './components/switchbar'
|
|
43
|
+
export type { SwitchBarProps } from './components/switchbar/types'
|
|
48
44
|
|
|
49
|
-
export { default as
|
|
50
|
-
export type {
|
|
45
|
+
export { default as Tab } from './components/tab'
|
|
46
|
+
export type { TabProps } from './components/tab/types'
|
|
51
47
|
|
|
52
|
-
export { default as
|
|
53
|
-
export type {
|
|
48
|
+
export { default as TextBar } from './components/Text'
|
|
49
|
+
export type { TextBarProps } from './components/Text/types'
|
|
54
50
|
|
|
55
|
-
export { default as
|
|
56
|
-
export type {
|
|
51
|
+
export { default as Number } from './components/number'
|
|
52
|
+
export type { NumberProps } from './components/number/types'
|
|
57
53
|
|
|
58
|
-
export { default as
|
|
59
|
-
export type {
|
|
54
|
+
export { default as ToTop } from './components/toTop'
|
|
55
|
+
export type { ToTopProps } from './components/toTop/types'
|
|
60
56
|
|
|
61
|
-
export { default as
|
|
62
|
-
export type {
|
|
57
|
+
export { default as Upload } from './components/upload'
|
|
58
|
+
export type { UploadProps } from './components/upload/types'
|
|
63
59
|
|
|
64
|
-
export { default as
|
|
65
|
-
export type {
|
|
60
|
+
export { default as SlideBar } from './components/slideBar'
|
|
61
|
+
export type { SlideBarProps } from './components/slideBar/types'
|
|
66
62
|
|
|
67
|
-
export { default as
|
|
68
|
-
export type {
|
|
63
|
+
export { default as DpProgress } from './components/progress'
|
|
64
|
+
export type { ProgressProps } from './components/progress/types'
|
|
69
65
|
|
|
70
|
-
export { default as
|
|
71
|
-
export type {
|
|
66
|
+
export { default as DpLoadMore } from './components/loadMore'
|
|
67
|
+
export type { LoadmoreProps } from './components/loadMore/types'
|
|
72
68
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// export type { ModalProps } from '../components/modal/types'
|
|
69
|
+
export { default as CheckBox, default as CheckBoxGroup } from './components/checkBox'
|
|
70
|
+
export type { CheckBoxProps, CheckBoxGroupProps } from './components/checkBox/types'
|
|
71
|
+
|
|
72
|
+
export { default as RadioBox, default as RadioBoxGroup } from './components/radioBox'
|
|
73
|
+
export type { RadioBoxProps, RadioGroupProps } from './components/radioBox/types'
|
|
79
74
|
|
|
80
75
|
/* ----------------------------------
|
|
81
76
|
* 2️⃣ 全局组件声明(给 <template> 用)
|
|
82
77
|
* ---------------------------------- */
|
|
83
|
-
import type { App
|
|
84
|
-
import type {
|
|
85
|
-
import type {
|
|
86
|
-
import type {
|
|
87
|
-
import type {
|
|
88
|
-
|
|
89
|
-
import type { CellProps } from '../components/cell/types'
|
|
90
|
-
import type { CellSwipeProps } from '../components/cellSwipe/types'
|
|
91
|
-
import type { HeaderProps } from '../components/header/types'
|
|
92
|
-
import type { SpinnerProps } from '../components/spinner/types'
|
|
93
|
-
import type { SwipeProps } from '../components/swipe/types'
|
|
94
|
-
import type { ButtonProps } from '../components/button/types'
|
|
95
|
-
import type { PickerProps } from '../components/picker/types'
|
|
96
|
-
import type { SwitchBarProps } from '../components/switchbar/types'
|
|
97
|
-
import type { TabProps } from '../components/tab/types'
|
|
98
|
-
import type { TextBarProps } from '../components/Text/types'
|
|
99
|
-
import type { NumberProps } from '../components/Number/types'
|
|
100
|
-
import type { ToTopProps } from '../components/toTop/types'
|
|
101
|
-
import type { UploadProps } from '../components/upload/types'
|
|
102
|
-
import type { SlideBarProps } from '../components/slideBar/types'
|
|
103
|
-
import type { ModalInstance } from '../components/modal/types'
|
|
104
|
-
import type { MessageInstance } from '../components/message/types'
|
|
105
|
-
import type { IndicatorInstance } from '../components/Indicator/types'
|
|
106
|
-
import type { ProgressProps } from '../components/progress/types'
|
|
107
|
-
import type { LoadmoreProps } from '../components/loadMore/types'
|
|
108
|
-
import type { CheckBoxProps } from '../components/checkBox/types'
|
|
109
|
-
import type { CheckBoxGroupProps } from '../components/checkBox/types'
|
|
110
|
-
import type { RadioBoxProps } from '../components/radioBox/types'
|
|
111
|
-
import type { RadioGroupProps } from '../components/radioBox/types'
|
|
112
|
-
import type { PromptInstance } from '../components/Prompt/types'
|
|
113
|
-
// src/shims-vue.d.ts
|
|
78
|
+
import type { App } from 'vue'
|
|
79
|
+
import type { ModalInstance } from './components/modal/types'
|
|
80
|
+
import type { MessageInstance } from './components/message/types'
|
|
81
|
+
import type { IndicatorInstance } from './components/Indicator/types'
|
|
82
|
+
import type { PromptInstance } from './components/prompt/types'
|
|
83
|
+
|
|
114
84
|
declare module 'vue' {
|
|
115
85
|
interface ComponentCustomProperties {
|
|
116
86
|
$Modal: ModalInstance
|
|
@@ -118,36 +88,33 @@ declare module 'vue' {
|
|
|
118
88
|
$Indicator: IndicatorInstance
|
|
119
89
|
$Prompt: PromptInstance
|
|
120
90
|
}
|
|
91
|
+
|
|
121
92
|
export interface GlobalComponents {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
CheckBoxGroup: typeof import('../components/checkBox')['CheckBoxGroup'],
|
|
148
|
-
CheckBox: typeof import('../components/checkBox')['CheckBox'],
|
|
149
|
-
RadioBoxGroup: typeof import('../components/radioBox')['RadioBoxGroup'],
|
|
150
|
-
RadioBox: typeof import('../components/radioBox')['RadioBox'],
|
|
93
|
+
Badge: typeof import('./components/badge')['default']
|
|
94
|
+
Popup: typeof import('./components/popup')['default']
|
|
95
|
+
ActionSheet: typeof import('./components/actionSheet')['default']
|
|
96
|
+
Card: typeof import('./components/card')['default']
|
|
97
|
+
Rater: typeof import('./components/rater')['default']
|
|
98
|
+
Cell: typeof import('./components/cell')['default']
|
|
99
|
+
CellSwipe: typeof import('./components/cellSwipe')['default']
|
|
100
|
+
DpHeader: typeof import('./components/header')['default']
|
|
101
|
+
Spinner: typeof import('./components/spinner')['default']
|
|
102
|
+
Swipe: typeof import('./components/swipe')['default']
|
|
103
|
+
DpButton: typeof import('./components/button')['default']
|
|
104
|
+
Picker: typeof import('./components/picker')['default']
|
|
105
|
+
SwitchBar: typeof import('./components/switchbar')['default']
|
|
106
|
+
Tab: typeof import('./components/tab')['default']
|
|
107
|
+
TextBar: typeof import('./components/Text')['default']
|
|
108
|
+
Number: typeof import('./components/number')['default']
|
|
109
|
+
ToTop: typeof import('./components/toTop')['default']
|
|
110
|
+
Upload: typeof import('./components/upload')['default']
|
|
111
|
+
SlideBar: typeof import('./components/slideBar')['default']
|
|
112
|
+
DpProgress: typeof import('./components/progress')['default']
|
|
113
|
+
DpLoadMore: typeof import('./components/loadMore')['default']
|
|
114
|
+
CheckBox: typeof import('./components/checkBox')['CheckBox']
|
|
115
|
+
CheckBoxGroup: typeof import('./components/checkBox')['CheckBoxGroup']
|
|
116
|
+
RadioBox: typeof import('./components/radioBox')['RadioBox']
|
|
117
|
+
RadioBoxGroup: typeof import('./components/radioBox')['RadioBoxGroup']
|
|
151
118
|
}
|
|
152
119
|
}
|
|
153
120
|
|
|
@@ -155,8 +122,8 @@ declare module 'vue' {
|
|
|
155
122
|
* 3️⃣ 默认导出整个组件库为 Vue 插件
|
|
156
123
|
* ---------------------------------- */
|
|
157
124
|
import type { Plugin } from 'vue'
|
|
158
|
-
|
|
159
|
-
export default
|
|
125
|
+
export const Dpzvc3UI: Plugin
|
|
126
|
+
export default Dpzvc3UI
|
|
160
127
|
|
|
161
128
|
/* ----------------------------------
|
|
162
129
|
* 4️⃣ 保证这是 module
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dpzvc3-ui",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "Vue3组件库",
|
|
5
5
|
"main": "dist/dpzvc3.js",
|
|
6
6
|
"module": "dist/dpzvc3.esm.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"build:style": "gulp --gulpfile build-style.js",
|
|
12
12
|
"build:dev": "webpack --config webpack.dist.dev.config.js",
|
|
13
13
|
"build:prod": "webpack --config webpack.dist.prod.config.js",
|
|
14
|
-
"build:types": "tsc --project tsconfig.build.json && cp src/
|
|
14
|
+
"build:types": "tsc --project tsconfig.build.json && cp src/index.d.ts dist/types/index.d.ts",
|
|
15
15
|
"build": "npm run build:style && npm run build:dev && npm run build:prod && npm run build:types",
|
|
16
16
|
"dist": "webpack --progress --config webpack.prod.config.js",
|
|
17
17
|
"prepare": "husky"
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// src/types/index.d.ts
|
|
2
|
+
|
|
3
|
+
/* ----------------------------------
|
|
4
|
+
* 1️⃣ 按需导出组件 & props(给 TS import 用)
|
|
5
|
+
* ---------------------------------- */
|
|
6
|
+
export { default as Badge } from './components/badge'
|
|
7
|
+
export type { BadgeProps } from './components/badge/types'
|
|
8
|
+
|
|
9
|
+
export { default as Popup } from './components/popup'
|
|
10
|
+
export type { PopupProps } from './components/popup/types'
|
|
11
|
+
|
|
12
|
+
export { default as ActionSheet } from './components/actionSheet'
|
|
13
|
+
export type { ActionSheetProps } from './components/actionSheet/types'
|
|
14
|
+
|
|
15
|
+
export { default as Card } from './components/card'
|
|
16
|
+
export type { CardProps } from './components/card/types'
|
|
17
|
+
|
|
18
|
+
export { default as Rater } from './components/rater'
|
|
19
|
+
export type { RaterProps } from './components/rater/types'
|
|
20
|
+
|
|
21
|
+
export { default as Cell } from './components/cell'
|
|
22
|
+
export type { CellProps } from './components/cell/types'
|
|
23
|
+
|
|
24
|
+
export { default as CellSwipe } from './components/cellSwipe'
|
|
25
|
+
export type { CellSwipeProps } from './components/cellSwipe/types'
|
|
26
|
+
|
|
27
|
+
export { default as DpHeader } from './components/header'
|
|
28
|
+
export type { HeaderProps } from './components/header/types'
|
|
29
|
+
|
|
30
|
+
export { default as Spinner } from './components/spinner'
|
|
31
|
+
export type { SpinnerProps } from './components/spinner/types'
|
|
32
|
+
|
|
33
|
+
export { default as Swipe } from './components/swipe'
|
|
34
|
+
export type { SwipeProps } from './components/swipe/types'
|
|
35
|
+
|
|
36
|
+
export { default as DpButton } from './components/button'
|
|
37
|
+
export type { ButtonProps } from './components/button/types'
|
|
38
|
+
|
|
39
|
+
export { default as Picker } from './components/picker'
|
|
40
|
+
export type { PickerProps } from './components/picker/types'
|
|
41
|
+
|
|
42
|
+
export { default as SwitchBar } from './components/switchbar'
|
|
43
|
+
export type { SwitchBarProps } from './components/switchbar/types'
|
|
44
|
+
|
|
45
|
+
export { default as Tab } from './components/tab'
|
|
46
|
+
export type { TabProps } from './components/tab/types'
|
|
47
|
+
|
|
48
|
+
export { default as TextBar } from './components/Text'
|
|
49
|
+
export type { TextBarProps } from './components/Text/types'
|
|
50
|
+
|
|
51
|
+
export { default as Number } from './components/number'
|
|
52
|
+
export type { NumberProps } from './components/number/types'
|
|
53
|
+
|
|
54
|
+
export { default as ToTop } from './components/toTop'
|
|
55
|
+
export type { ToTopProps } from './components/toTop/types'
|
|
56
|
+
|
|
57
|
+
export { default as Upload } from './components/upload'
|
|
58
|
+
export type { UploadProps } from './components/upload/types'
|
|
59
|
+
|
|
60
|
+
export { default as SlideBar } from './components/slideBar'
|
|
61
|
+
export type { SlideBarProps } from './components/slideBar/types'
|
|
62
|
+
|
|
63
|
+
export { default as DpProgress } from './components/progress'
|
|
64
|
+
export type { ProgressProps } from './components/progress/types'
|
|
65
|
+
|
|
66
|
+
export { default as DpLoadMore } from './components/loadMore'
|
|
67
|
+
export type { LoadmoreProps } from './components/loadMore/types'
|
|
68
|
+
|
|
69
|
+
export { default as CheckBox, default as CheckBoxGroup } from './components/checkBox'
|
|
70
|
+
export type { CheckBoxProps, CheckBoxGroupProps } from './components/checkBox/types'
|
|
71
|
+
|
|
72
|
+
export { default as RadioBox, default as RadioBoxGroup } from './components/radioBox'
|
|
73
|
+
export type { RadioBoxProps, RadioGroupProps } from './components/radioBox/types'
|
|
74
|
+
|
|
75
|
+
/* ----------------------------------
|
|
76
|
+
* 2️⃣ 全局组件声明(给 <template> 用)
|
|
77
|
+
* ---------------------------------- */
|
|
78
|
+
import type { App } from 'vue'
|
|
79
|
+
import type { ModalInstance } from './components/modal/types'
|
|
80
|
+
import type { MessageInstance } from './components/message/types'
|
|
81
|
+
import type { IndicatorInstance } from './components/Indicator/types'
|
|
82
|
+
import type { PromptInstance } from './components/prompt/types'
|
|
83
|
+
|
|
84
|
+
declare module 'vue' {
|
|
85
|
+
interface ComponentCustomProperties {
|
|
86
|
+
$Modal: ModalInstance
|
|
87
|
+
$Message: MessageInstance
|
|
88
|
+
$Indicator: IndicatorInstance
|
|
89
|
+
$Prompt: PromptInstance
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface GlobalComponents {
|
|
93
|
+
Badge: typeof import('./components/badge')['default']
|
|
94
|
+
Popup: typeof import('./components/popup')['default']
|
|
95
|
+
ActionSheet: typeof import('./components/actionSheet')['default']
|
|
96
|
+
Card: typeof import('./components/card')['default']
|
|
97
|
+
Rater: typeof import('./components/rater')['default']
|
|
98
|
+
Cell: typeof import('./components/cell')['default']
|
|
99
|
+
CellSwipe: typeof import('./components/cellSwipe')['default']
|
|
100
|
+
DpHeader: typeof import('./components/header')['default']
|
|
101
|
+
Spinner: typeof import('./components/spinner')['default']
|
|
102
|
+
Swipe: typeof import('./components/swipe')['default']
|
|
103
|
+
DpButton: typeof import('./components/button')['default']
|
|
104
|
+
Picker: typeof import('./components/picker')['default']
|
|
105
|
+
SwitchBar: typeof import('./components/switchbar')['default']
|
|
106
|
+
Tab: typeof import('./components/tab')['default']
|
|
107
|
+
TextBar: typeof import('./components/Text')['default']
|
|
108
|
+
Number: typeof import('./components/number')['default']
|
|
109
|
+
ToTop: typeof import('./components/toTop')['default']
|
|
110
|
+
Upload: typeof import('./components/upload')['default']
|
|
111
|
+
SlideBar: typeof import('./components/slideBar')['default']
|
|
112
|
+
DpProgress: typeof import('./components/progress')['default']
|
|
113
|
+
DpLoadMore: typeof import('./components/loadMore')['default']
|
|
114
|
+
CheckBox: typeof import('./components/checkBox')['CheckBox']
|
|
115
|
+
CheckBoxGroup: typeof import('./components/checkBox')['CheckBoxGroup']
|
|
116
|
+
RadioBox: typeof import('./components/radioBox')['RadioBox']
|
|
117
|
+
RadioBoxGroup: typeof import('./components/radioBox')['RadioBoxGroup']
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* ----------------------------------
|
|
122
|
+
* 3️⃣ 默认导出整个组件库为 Vue 插件
|
|
123
|
+
* ---------------------------------- */
|
|
124
|
+
import type { Plugin } from 'vue'
|
|
125
|
+
export const Dpzvc3UI: Plugin
|
|
126
|
+
export default Dpzvc3UI
|
|
127
|
+
|
|
128
|
+
/* ----------------------------------
|
|
129
|
+
* 4️⃣ 保证这是 module
|
|
130
|
+
* ---------------------------------- */
|
|
131
|
+
export {}
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Vue 3 组件库入口 ts 版本
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { App,Plugin } from 'vue'
|
|
5
|
+
import type { App, Plugin } from 'vue'
|
|
6
6
|
|
|
7
7
|
/* ========= 组件引入 ========= */
|
|
8
8
|
import DpButton from './components/button'
|
|
@@ -33,16 +33,8 @@ import Badge from './components/badge'
|
|
|
33
33
|
import Card from './components/card'
|
|
34
34
|
import Number from './components/number'
|
|
35
35
|
|
|
36
|
-
/* ========= Installable 泛型 ========= */
|
|
37
|
-
// export type Installable<T> = T & {
|
|
38
|
-
// install?: (app: App) => void
|
|
39
|
-
// }
|
|
40
|
-
export type Components = {
|
|
41
|
-
[K in keyof typeof _components]: any//Installable<typeof _components[K]>
|
|
42
|
-
}
|
|
43
|
-
export const components: Components = {} as Components
|
|
44
36
|
/* ========= 组件集合 ========= */
|
|
45
|
-
const
|
|
37
|
+
const components = {
|
|
46
38
|
DpButton,
|
|
47
39
|
CheckBox,
|
|
48
40
|
CheckBoxGroup,
|
|
@@ -68,73 +60,42 @@ const _components = {
|
|
|
68
60
|
CellSwipe,
|
|
69
61
|
Badge,
|
|
70
62
|
Card
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// {
|
|
74
|
-
// VButton: typeof VButton
|
|
75
|
-
// CheckBox: typeof CheckBox
|
|
76
|
-
// CheckBoxGroup: typeof CheckBoxGroup
|
|
77
|
-
// }
|
|
78
|
-
如果直接写[K in keyof _components]报错Type '_components' is not a type. 原因就是 _components 是 值,不是类型。
|
|
79
|
-
• keyof 只能作用在 类型上。
|
|
80
|
-
• 所以必须先用 typeof 变成类型:keyof typeof _components。
|
|
81
|
-
*/
|
|
82
|
-
/* ========= 生成 Installable 类型组件集合 ========= */
|
|
83
|
-
// export const components: {
|
|
84
|
-
// [K in keyof typeof _components]: Installable<typeof _components[K]>
|
|
85
|
-
// } = {} as any
|
|
86
|
-
// 遍历给组件加 install
|
|
87
|
-
Object.keys(_components).forEach((key) => {
|
|
88
|
-
// const component = _components[key as keyof typeof _components] as Installable<
|
|
89
|
-
// typeof _components[keyof typeof _components]
|
|
90
|
-
// >
|
|
91
|
-
const component = _components[key as keyof typeof _components]
|
|
92
|
-
if (component && !component.install) {
|
|
93
|
-
component.install = (app: App) => {
|
|
94
|
-
// console.log(key, component, '----component----')
|
|
95
|
-
app.component(key, component)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
components[key as keyof typeof _components] = component
|
|
99
|
-
// console.log(components, '----components----')
|
|
100
|
-
})
|
|
63
|
+
} as const
|
|
64
|
+
|
|
101
65
|
/* ========= 服务组件 ========= */
|
|
102
|
-
|
|
66
|
+
const services = {
|
|
103
67
|
Message,
|
|
104
68
|
Modal,
|
|
105
69
|
Prompt,
|
|
106
70
|
Indicator
|
|
107
|
-
}
|
|
71
|
+
} as const
|
|
108
72
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
app.
|
|
73
|
+
/* ========= 遍历注册组件 ========= */
|
|
74
|
+
Object.values(components).forEach((comp: any) => {
|
|
75
|
+
if (comp && !comp.install) {
|
|
76
|
+
comp.install = (app: App) => {
|
|
77
|
+
app.component(comp.name, comp)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
/* ========= 遍历注册服务 ========= */
|
|
83
|
+
Object.values(services).forEach((srv: any, idx) => {
|
|
84
|
+
if (srv && !srv.install) {
|
|
85
|
+
const key = Object.keys(services)[idx]
|
|
86
|
+
srv.install = (app: App) => {
|
|
87
|
+
app.config.globalProperties[`$${key}`] = srv
|
|
114
88
|
}
|
|
115
89
|
}
|
|
116
90
|
})
|
|
117
91
|
|
|
118
92
|
/* ========= 全量 install ========= */
|
|
119
93
|
export const install: Plugin['install'] = (app: App) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'dpzvc3 install: app is undefined, ensure you are using Vue 3 createApp'
|
|
123
|
-
)
|
|
124
|
-
return
|
|
125
|
-
}
|
|
126
|
-
// 注册组件
|
|
127
|
-
Object.values(components).forEach((comp) => {
|
|
128
|
-
if (comp.install) {
|
|
129
|
-
comp.install(app)
|
|
130
|
-
}
|
|
94
|
+
Object.values(components).forEach((comp: any) => {
|
|
95
|
+
comp.install?.(app)
|
|
131
96
|
})
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
Object.values(services).forEach((srv) => {
|
|
135
|
-
if (srv.install) {
|
|
136
|
-
srv.install(app)
|
|
137
|
-
}
|
|
97
|
+
Object.values(services).forEach((srv: any) => {
|
|
98
|
+
srv.install?.(app)
|
|
138
99
|
})
|
|
139
100
|
}
|
|
140
101
|
|
|
@@ -149,6 +110,7 @@ export {
|
|
|
149
110
|
Prompt,
|
|
150
111
|
Picker,
|
|
151
112
|
RadioBox,
|
|
113
|
+
RadioBoxGroup,
|
|
152
114
|
Swipe,
|
|
153
115
|
Tab,
|
|
154
116
|
SlideBar,
|
|
@@ -168,6 +130,7 @@ export {
|
|
|
168
130
|
Badge,
|
|
169
131
|
Card
|
|
170
132
|
}
|
|
171
|
-
|
|
133
|
+
|
|
172
134
|
/* ========= 默认导出 ========= */
|
|
173
|
-
|
|
135
|
+
const Dpzvc3UI: Plugin = { install }
|
|
136
|
+
export default Dpzvc3UI
|