hy-app 0.2.13 → 0.2.15

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.
Files changed (223) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +81 -13
  2. package/components/hy-action-sheet/typing.d.ts +1 -3
  3. package/components/hy-address-picker/hy-address-picker.vue +109 -8
  4. package/components/hy-address-picker/index.scss +2 -2
  5. package/components/hy-address-picker/typing.d.ts +39 -30
  6. package/components/hy-avatar/hy-avatar.vue +78 -4
  7. package/components/hy-avatar/typing.d.ts +21 -16
  8. package/components/hy-back-top/hy-back-top.vue +86 -28
  9. package/components/hy-back-top/typing.d.ts +17 -12
  10. package/components/hy-badge/hy-badge.vue +114 -43
  11. package/components/hy-badge/typing.d.ts +20 -15
  12. package/components/hy-button/HyButton.docgen.js +6 -0
  13. package/components/hy-button/hy-button.vue +70 -77
  14. package/components/hy-button/props.ts +40 -41
  15. package/components/hy-calendar/hy-calendar.vue +290 -143
  16. package/components/hy-calendar/typing.d.ts +38 -31
  17. package/components/hy-card/hy-card.vue +139 -36
  18. package/components/hy-card/typing.d.ts +39 -28
  19. package/components/hy-cell/hy-cell.vue +131 -67
  20. package/components/hy-cell/typing.d.ts +6 -1
  21. package/components/hy-check-button/hy-check-button.vue +101 -32
  22. package/components/hy-check-button/typing.d.ts +26 -19
  23. package/components/hy-checkbox/hy-checkbox.vue +167 -78
  24. package/components/hy-checkbox/typing.d.ts +26 -19
  25. package/components/hy-code-input/hy-code-input.vue +101 -5
  26. package/components/hy-code-input/typing.d.ts +9 -0
  27. package/components/hy-config-provider/hy-config-provider.vue +44 -24
  28. package/components/hy-config-provider/typing.d.ts +0 -4
  29. package/components/hy-count-down/hy-count-down.vue +99 -62
  30. package/components/hy-count-down/typing.d.ts +18 -5
  31. package/components/hy-count-to/hy-count-to.vue +165 -113
  32. package/components/hy-count-to/typing.d.ts +15 -11
  33. package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
  34. package/components/hy-datetime-picker/typing.d.ts +49 -39
  35. package/components/hy-divider/hy-divider.vue +128 -64
  36. package/components/hy-divider/typing.d.ts +16 -16
  37. package/components/hy-dropdown/hy-dropdown.vue +57 -19
  38. package/components/hy-dropdown/typing.d.ts +14 -14
  39. package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
  40. package/components/hy-dropdown-item/typing.d.ts +13 -6
  41. package/components/hy-empty/hy-empty.vue +64 -6
  42. package/components/hy-empty/typing.d.ts +5 -0
  43. package/components/hy-float-button/hy-float-button.vue +117 -5
  44. package/components/hy-float-button/typing.d.ts +7 -0
  45. package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
  46. package/components/hy-folding-panel/typing.d.ts +24 -15
  47. package/components/hy-grid/hy-grid.vue +95 -35
  48. package/components/hy-grid/typing.d.ts +24 -19
  49. package/components/hy-icon/hy-icon.vue +84 -6
  50. package/components/hy-icon/typing.d.ts +5 -0
  51. package/components/hy-image/hy-image.vue +105 -6
  52. package/components/hy-image/typing.d.ts +9 -0
  53. package/components/hy-input/hy-input.vue +277 -130
  54. package/components/hy-input/props.ts +13 -14
  55. package/components/hy-input/typing.d.ts +59 -38
  56. package/components/hy-line/hy-line.vue +65 -25
  57. package/components/hy-line-progress/hy-line-progress.vue +68 -35
  58. package/components/hy-list/hy-list.vue +127 -61
  59. package/components/hy-list/typing.d.ts +19 -12
  60. package/components/hy-loading/hy-loading.vue +79 -25
  61. package/components/hy-menu/hy-menu.vue +69 -45
  62. package/components/hy-menu/typing.d.ts +22 -15
  63. package/components/hy-modal/hy-modal.vue +91 -4
  64. package/components/hy-modal/typing.d.ts +11 -0
  65. package/components/hy-navbar/hy-navbar.vue +105 -25
  66. package/components/hy-navbar/typing.d.ts +25 -20
  67. package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
  68. package/components/hy-notice-bar/typing.d.ts +22 -17
  69. package/components/hy-notify/hy-notify.vue +106 -54
  70. package/components/hy-number-step/hy-number-step.vue +211 -120
  71. package/components/hy-number-step/typing.d.ts +45 -28
  72. package/components/hy-overlay/hy-overlay.vue +60 -16
  73. package/components/hy-overlay/typing.d.ts +11 -6
  74. package/components/hy-pagination/hy-pagination.vue +94 -37
  75. package/components/hy-pagination/typing.d.ts +20 -11
  76. package/components/hy-picker/hy-picker.vue +225 -160
  77. package/components/hy-picker/typing.d.ts +51 -28
  78. package/components/hy-popover/hy-popover.vue +55 -7
  79. package/components/hy-popover/typing.d.ts +21 -1
  80. package/components/hy-popup/hy-popup.vue +164 -99
  81. package/components/hy-popup/typing.d.ts +11 -0
  82. package/components/hy-price/hy-price.vue +77 -30
  83. package/components/hy-price/typing.d.ts +10 -10
  84. package/components/hy-qrcode/hy-qrcode.vue +75 -5
  85. package/components/hy-qrcode/typing.d.ts +25 -16
  86. package/components/hy-radio/hy-radio.vue +169 -88
  87. package/components/hy-radio/typing.d.ts +29 -22
  88. package/components/hy-rate/hy-rate.vue +155 -104
  89. package/components/hy-rate/typing.d.ts +23 -16
  90. package/components/hy-read-more/hy-read-more.vue +83 -56
  91. package/components/hy-read-more/typing.d.ts +18 -11
  92. package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
  93. package/components/hy-scroll-list/typing.d.ts +14 -7
  94. package/components/hy-search/hy-search.vue +168 -62
  95. package/components/hy-search/typing.d.ts +47 -26
  96. package/components/hy-signature/hy-signature.vue +354 -272
  97. package/components/hy-signature/typing.d.ts +65 -52
  98. package/components/hy-slider/hy-slider.vue +208 -160
  99. package/components/hy-slider/typing.d.ts +28 -17
  100. package/components/hy-steps/hy-steps.vue +125 -99
  101. package/components/hy-steps/typing.d.ts +21 -14
  102. package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
  103. package/components/hy-submit-bar/typing.d.ts +30 -23
  104. package/components/hy-subsection/hy-subsection.vue +139 -96
  105. package/components/hy-subsection/typing.d.ts +23 -16
  106. package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
  107. package/components/hy-swipe-action/typing.d.ts +26 -17
  108. package/components/hy-swiper/hy-swiper.vue +178 -73
  109. package/components/hy-swiper/typing.d.ts +37 -28
  110. package/components/hy-switch/hy-switch.vue +107 -60
  111. package/components/hy-switch/typing.d.ts +25 -18
  112. package/components/hy-tabs/hy-tabs.vue +170 -160
  113. package/components/hy-tabs/typing.d.ts +36 -22
  114. package/components/hy-tag/hy-tag.vue +133 -58
  115. package/components/hy-tag/typing.d.ts +26 -18
  116. package/components/hy-text/hy-text.vue +106 -6
  117. package/components/hy-text/typing.d.ts +31 -26
  118. package/components/hy-textarea/hy-textarea.vue +183 -89
  119. package/components/hy-textarea/typing.d.ts +41 -24
  120. package/components/hy-tooltip/hy-tooltip.vue +145 -101
  121. package/components/hy-tooltip/typing.d.ts +18 -13
  122. package/components/hy-transition/hy-transition.vue +48 -13
  123. package/components/hy-transition/typing.d.ts +17 -0
  124. package/components/hy-upload/hy-upload.vue +113 -148
  125. package/components/hy-upload/typing.d.ts +71 -71
  126. package/components/hy-warn/hy-warn.vue +79 -36
  127. package/components/hy-warn/typing.d.ts +18 -11
  128. package/components/hy-waterfall/hy-waterfall.vue +90 -77
  129. package/components/hy-watermark/hy-watermark.vue +82 -5
  130. package/components/hy-watermark/typing.d.ts +20 -20
  131. package/global.d.ts +39 -59
  132. package/package.json +5 -13
  133. package/utils/inspect.ts +3 -1
  134. package/web-types.json +1 -1
  135. package/component-helper.ts +0 -177
  136. package/components.json +0 -3287
  137. package/dist/attributes.json +0 -1
  138. package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
  139. package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
  140. package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
  141. package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
  142. package/dist/docs/components/hy-badge/hy-badge.md +0 -13
  143. package/dist/docs/components/hy-button/hy-button.md +0 -61
  144. package/dist/docs/components/hy-calendar/header.md +0 -17
  145. package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
  146. package/dist/docs/components/hy-calendar/month.md +0 -38
  147. package/dist/docs/components/hy-card/hy-card.md +0 -24
  148. package/dist/docs/components/hy-cell/hy-cell.md +0 -26
  149. package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
  150. package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
  151. package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
  152. package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
  153. package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
  154. package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
  155. package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
  156. package/dist/docs/components/hy-divider/hy-divider.md +0 -13
  157. package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
  158. package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
  159. package/dist/docs/components/hy-empty/hy-empty.md +0 -20
  160. package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
  161. package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
  162. package/dist/docs/components/hy-form/hy-form.md +0 -29
  163. package/dist/docs/components/hy-grid/hy-grid.md +0 -19
  164. package/dist/docs/components/hy-icon/hy-icon.md +0 -13
  165. package/dist/docs/components/hy-image/hy-image.md +0 -22
  166. package/dist/docs/components/hy-input/hy-input.md +0 -29
  167. package/dist/docs/components/hy-line/hy-line.md +0 -7
  168. package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
  169. package/dist/docs/components/hy-list/hy-list.md +0 -25
  170. package/dist/docs/components/hy-loading/hy-loading.md +0 -14
  171. package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
  172. package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
  173. package/dist/docs/components/hy-login/hy-login.md +0 -14
  174. package/dist/docs/components/hy-menu/hy-menu.md +0 -21
  175. package/dist/docs/components/hy-modal/hy-modal.md +0 -23
  176. package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
  177. package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
  178. package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
  179. package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
  180. package/dist/docs/components/hy-notify/hy-notify.md +0 -23
  181. package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
  182. package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
  183. package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
  184. package/dist/docs/components/hy-parse/hy-parse.md +0 -46
  185. package/dist/docs/components/hy-parse/node/node.md +0 -7
  186. package/dist/docs/components/hy-picker/hy-picker.md +0 -32
  187. package/dist/docs/components/hy-popover/hy-popover.md +0 -34
  188. package/dist/docs/components/hy-popup/hy-popup.md +0 -22
  189. package/dist/docs/components/hy-price/hy-price.md +0 -13
  190. package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
  191. package/dist/docs/components/hy-radio/hy-radio.md +0 -21
  192. package/dist/docs/components/hy-rate/hy-rate.md +0 -14
  193. package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
  194. package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
  195. package/dist/docs/components/hy-search/hy-search.md +0 -27
  196. package/dist/docs/components/hy-signature/hy-signature.md +0 -45
  197. package/dist/docs/components/hy-slider/hy-slider.md +0 -24
  198. package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
  199. package/dist/docs/components/hy-steps/hy-steps.md +0 -23
  200. package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
  201. package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
  202. package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
  203. package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
  204. package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
  205. package/dist/docs/components/hy-switch/hy-switch.md +0 -20
  206. package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
  207. package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
  208. package/dist/docs/components/hy-tag/hy-tag.md +0 -21
  209. package/dist/docs/components/hy-text/hy-text.md +0 -13
  210. package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
  211. package/dist/docs/components/hy-toast/hy-toast.md +0 -17
  212. package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
  213. package/dist/docs/components/hy-transition/hy-transition.md +0 -25
  214. package/dist/docs/components/hy-upload/hy-upload.md +0 -25
  215. package/dist/docs/components/hy-warn/hy-warn.md +0 -14
  216. package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
  217. package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
  218. package/dist/docs/components/message/TheMessage.md +0 -17
  219. package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
  220. package/dist/tags.json +0 -1
  221. package/dist/web-types.json +0 -1
  222. package/docgen.config.js +0 -14
  223. package/web-types.config.js +0 -7
@@ -2,125 +2,132 @@ export default interface HyCalendarProps {
2
2
  /**
3
3
  * @description 是否显示日历弹窗 (默认 false )
4
4
  * */
5
- show: boolean;
5
+ show: boolean
6
6
  /**
7
7
  * @description 标题内容 (默认 日期选择 )
8
8
  * */
9
- title?: string;
9
+ title?: string
10
10
  /**
11
11
  * @description 是否显示标题 (默认 true )
12
12
  * */
13
- showTitle?: boolean;
13
+ showTitle?: boolean
14
14
  /**
15
15
  * @description 是否显示副标题 (默认 true )
16
16
  * */
17
- showSubtitle?: boolean;
17
+ showSubtitle?: boolean
18
18
  /**
19
19
  * @description 日期类型选择 single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围 ( 默认 'single' )
20
20
  * */
21
- mode?: "single" | "range" | "multiple";
21
+ mode?: 'single' | 'range' | 'multiple'
22
22
  /**
23
23
  * @description mode=range时,第一个日期底部的提示文字 (默认 '开始' )
24
24
  * */
25
- startText?: string;
25
+ startText?: string
26
26
  /**
27
27
  * @description mode=range时,最后一个日期底部的提示文字 (默认 '结束' )
28
28
  * */
29
- endText?: string;
29
+ endText?: string
30
30
  /**
31
31
  * @description 自定义列表
32
32
  * */
33
- customList?: any[];
33
+ customList?: any[]
34
34
  /**
35
35
  * @description 主题色,对底部按钮和选中日期有效 (默认 ‘#3c9cff' )
36
36
  * */
37
- color?: string;
37
+ color?: string
38
38
  /**
39
39
  * @description 最小的可选日期 (默认 0 )
40
40
  * */
41
- minDate?: number | string;
41
+ minDate?: number | string
42
42
  /**
43
43
  * @description 最大可选日期 (默认 0 )
44
44
  * */
45
- maxDate?: number | string;
45
+ maxDate?: number | string
46
46
  /**
47
47
  * @description 默认选中的日期,mode为multiple或range是必须为数组格式
48
48
  * */
49
- defaultDate?: Date | string | string[] | null;
49
+ defaultDate?: Date | string | string[] | null
50
50
  /**
51
51
  * @description mode=multiple时,最多可选多少个日期 (默认 Number.MAX_SAFE_INTEGER )
52
52
  * */
53
- maxCount?: number;
53
+ maxCount?: number
54
54
  /**
55
55
  * @description 日期行高 (默认 56 )
56
56
  * */
57
- rowHeight?: number;
57
+ rowHeight?: number
58
58
  /**
59
59
  * @description 日期格式化函数
60
60
  * */
61
- formatter?: ((date: Date) => string) | null;
61
+ formatter?: ((date: Date) => string) | null
62
62
  /**
63
63
  * @description 是否显示农历 (默认 false )
64
64
  * */
65
- showLunar?: boolean;
65
+ showLunar?: boolean
66
66
  /**
67
67
  * @description 是否显示月份背景色 (默认 true )
68
68
  * */
69
- showMark?: boolean;
69
+ showMark?: boolean
70
70
  /**
71
71
  * @description 确定按钮的文字 (默认 '确定' )
72
72
  * */
73
- confirmText?: string;
73
+ confirmText?: string
74
74
  /**
75
75
  * @description 确认按钮处于禁用状态时的文字 (默认 '确定' )
76
76
  * */
77
- confirmDisabledText?: string;
77
+ confirmDisabledText?: string
78
78
  /**
79
79
  * @description 是否允许点击遮罩关闭日历 (默认 false )
80
80
  * */
81
- closeOnClickOverlay?: boolean;
81
+ closeOnClickOverlay?: boolean
82
82
  /**
83
83
  * @description 是否为只读状态,只读状态下禁止选择日期 (默认 false )
84
84
  * */
85
- readonly?: boolean;
85
+ readonly?: boolean
86
86
  /**
87
87
  * @description 是否展示确认按钮
88
88
  * */
89
- showConfirm?: boolean;
89
+ showConfirm?: boolean
90
90
  /**
91
91
  * @description 日期区间最多可选天数,默认无限制,mode = range时有效
92
92
  * */
93
- maxRange?: number;
93
+ maxRange?: number
94
94
  /**
95
95
  * @description 范围选择超过最多可选天数时的提示文案,mode = range时有效
96
96
  * */
97
- rangePrompt?: string | null;
97
+ rangePrompt?: string | null
98
98
  /**
99
99
  * @description 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 (默认 true )
100
100
  * */
101
- showRangePrompt?: boolean;
101
+ showRangePrompt?: boolean
102
102
  /**
103
103
  * @description 是否允许日期范围的起止时间为同一天,mode = range时有效 (默认 false )
104
104
  * */
105
- allowSameDay?: boolean;
105
+ allowSameDay?: boolean
106
106
  /**
107
107
  * @description 圆角值,默认无圆角 (默认 0 )
108
108
  * */
109
- round?: number;
109
+ round?: number
110
110
  /**
111
111
  * @description 最多展示的月份数量 (默认 3 )
112
112
  * */
113
- monthNum?: number;
113
+ monthNum?: number
114
114
  /**
115
115
  * @description 星期文案 (默认 ['一', '二', '三', '四', '五', '六', '日'] )
116
116
  * */
117
- weekText?: string[];
117
+ weekText?: string[]
118
118
  /**
119
119
  * @description 单选与多选禁止选中的日期列表,mode!=range时有效。
120
120
  * */
121
- forbidDays?: Date[];
121
+ forbidDays?: Date[]
122
122
  /**
123
123
  * @description 单选与多选禁止选中的日期选择时提示
124
124
  * */
125
- forbidDaysToast?: string;
125
+ forbidDaysToast?: string
126
+ }
127
+
128
+ export interface ICalendarEmit {
129
+ /** 日期选择完成后触发,则点击确认按钮后触发 */
130
+ (e: 'confirm', selected: string[]): void
131
+ /** 日历关闭时触发 */
132
+ (e: 'close'): void
126
133
  }
@@ -44,6 +44,7 @@
44
44
  </text>
45
45
  </view>
46
46
  </view>
47
+ <!-- @slot 头部插槽 -->
47
48
  <slot name="header" v-else />
48
49
  </view>
49
50
  <view
@@ -51,96 +52,198 @@
51
52
  class="hy-card__body"
52
53
  :style="[{ padding: addUnit(paddingBody || padding) }, bodyStyle]"
53
54
  >
55
+ <!-- @slot 中间内容插槽 -->
54
56
  <slot name="body" />
55
57
  </view>
56
58
  <view
57
59
  v-if="showFoot"
58
60
  class="hy-card__foot"
59
61
  @tap="footClick"
60
- :style="[
61
- { padding: $slots.foot ? addUnit(paddingFoot || padding) : 0 },
62
- footStyle,
63
- ]"
62
+ :style="[{ padding: $slots.foot ? addUnit(paddingFoot || padding) : 0 }, footStyle]"
64
63
  :class="{
65
64
  'hy-border-top': footBorderTop,
66
65
  }"
67
66
  >
67
+ <!-- @slot 底部插槽 -->
68
68
  <slot name="footer" />
69
69
  </view>
70
70
  </view>
71
71
  </template>
72
72
 
73
73
  <script lang="ts">
74
+ /**
75
+ * 卡片组件一般用于多个列表条目,且风格统一的场景。
76
+ * @displayName hy-card
77
+ */
78
+ defineOptions({})
74
79
  export default {
75
80
  name: 'hy-card',
76
81
  options: {
77
82
  addGlobalClass: true,
78
83
  virtualHost: true,
79
- styleIsolation: 'shared'
80
- }
84
+ styleIsolation: 'shared',
85
+ },
81
86
  }
82
87
  </script>
83
88
 
84
89
  <script setup lang="ts">
85
- import defaultProps from "./props";
86
- import type IProps from "./typing";
87
- import { addUnit } from "../../utils";
88
- import { computed, toRefs } from "vue";
90
+ import type { ICardEmits } from './typing'
91
+ import { addUnit } from '../../utils'
92
+ import { computed, type CSSProperties, PropType, toRefs } from 'vue'
89
93
 
90
- const props = withDefaults(defineProps<IProps>(), defaultProps);
91
- const { border, full, borderRadius, margin, boxShadow, customStyle } =
92
- toRefs(props);
93
- const emit = defineEmits(["click", "head-click", "body-click", "foot-click"]);
94
+ // const props = withDefaults(defineProps<IProps>(), defaultProps);
95
+ const props = defineProps({
96
+ /** 卡片与屏幕两侧是否留空隙 */
97
+ full: {
98
+ type: Boolean,
99
+ default: false,
100
+ },
101
+ /** 头部左边的标题 */
102
+ title: String,
103
+ /** 标题颜色 */
104
+ titleColor: String,
105
+ /** 标题字体大小,单位rpx */
106
+ titleSize: {
107
+ type: String,
108
+ default: '18px',
109
+ },
110
+ /** 头部右边的副标题 */
111
+ subTitle: String,
112
+ /** 副标题颜色 */
113
+ subTitleColor: {
114
+ type: String,
115
+ default: '#909399',
116
+ },
117
+ /** 副标题字体大小 */
118
+ subTitleSize: {
119
+ type: [String, Number],
120
+ default: 13,
121
+ },
122
+ /** 是否显示边框 */
123
+ border: {
124
+ type: Boolean,
125
+ default: true,
126
+ },
127
+ /** 用于标识点击了第几个卡片 */
128
+ index: [String, Number],
129
+ /** 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px" */
130
+ margin: {
131
+ type: String,
132
+ default: '15px',
133
+ },
134
+ /** 卡片整体的圆角值,单位px */
135
+ borderRadius: {
136
+ type: [String, Number],
137
+ default: 8,
138
+ },
139
+ /** 是否显示头部的下边框 */
140
+ headBorderBottom: {
141
+ type: Boolean,
142
+ default: true,
143
+ },
144
+ /** 是否显示底部的上边框 */
145
+ footBorderTop: {
146
+ type: Boolean,
147
+ default: true,
148
+ },
149
+ /** 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径 */
150
+ thumb: String,
151
+ /** 缩略图的宽度,高等于宽,单位px */
152
+ thumbWidth: {
153
+ type: [String, Number],
154
+ default: 30,
155
+ },
156
+ /** 缩略图是否为圆形 */
157
+ thumbCircle: {
158
+ type: Boolean,
159
+ default: false,
160
+ },
161
+ /** 给head,body,foot的内边距 */
162
+ padding: {
163
+ type: [String, Number],
164
+ default: 15,
165
+ },
166
+ /** 头部内边距 */
167
+ paddingHead: [String, Number],
168
+ /** 中部内边距 */
169
+ paddingBody: [String, Number],
170
+ /** 尾部内边距 */
171
+ paddingFoot: [String, Number],
172
+ /** 是否显示头部 */
173
+ showHead: {
174
+ type: Boolean,
175
+ default: true,
176
+ },
177
+ /** 是否显示尾部 */
178
+ showFoot: {
179
+ type: Boolean,
180
+ default: true,
181
+ },
182
+ /** 卡片外围阴影,字符串形式 */
183
+ boxShadow: {
184
+ type: Boolean,
185
+ default: true,
186
+ },
187
+ /** 头部自定义样式,对象形式 */
188
+ headStyle: Object as unknown as PropType<CSSProperties>,
189
+ /** 中部自定义样式 */
190
+ bodyStyle: Object as unknown as PropType<CSSProperties>,
191
+ /** 底部自定义样式 */
192
+ footStyle: Object as unknown as PropType<CSSProperties>,
193
+ /** 定义需要用到的外部样式 */
194
+ customStyle: Object as unknown as PropType<CSSProperties>,
195
+ })
196
+ const { border, full, borderRadius, margin, boxShadow, customStyle } = toRefs(props)
197
+ const emit = defineEmits<ICardEmits>()
94
198
 
95
199
  const cardClass = computed(() => {
96
200
  return [
97
- border.value && "hy-border",
98
- full.value && "hy-border",
99
- border.value && "hy-card-full",
100
- (typeof borderRadius.value === "number"
201
+ border.value && 'hy-border',
202
+ full.value && 'hy-border',
203
+ border.value && 'hy-card-full',
204
+ (typeof borderRadius.value === 'number'
101
205
  ? borderRadius.value
102
- : parseInt(borderRadius.value.replace(/px|rpx|vw|vh/g, "")) > 0) &&
103
- "hy-card--border",
104
- ].filter(Boolean);
105
- });
206
+ : parseInt(borderRadius.value.replace(/px|rpx|vw|vh/g, '')) > 0) && 'hy-card--border',
207
+ ].filter(Boolean)
208
+ })
106
209
  const cardStyle = computed(() => {
107
210
  return Object.assign(
108
211
  {
109
212
  borderRadius: addUnit(borderRadius.value),
110
213
  margin: margin.value,
111
214
  boxShadow: boxShadow.value
112
- ? typeof boxShadow.value === "boolean"
113
- ? "0 0 10rpx 4rpx rgba(0, 0, 0, 0.16)"
215
+ ? typeof boxShadow.value === 'boolean'
216
+ ? '0 0 10rpx 4rpx rgba(0, 0, 0, 0.16)'
114
217
  : boxShadow.value
115
- : "",
218
+ : '',
116
219
  },
117
220
  customStyle.value,
118
- );
119
- });
221
+ )
222
+ })
120
223
 
121
224
  const click = () => {
122
- emit("click", props.index);
123
- };
225
+ emit('click', props.index)
226
+ }
124
227
  /**
125
228
  * @description 点击头部
126
229
  * */
127
230
  const headClick = () => {
128
- emit("head-click", props.index);
129
- };
231
+ emit('head-click', props.index)
232
+ }
130
233
  /**
131
234
  * @description 点击身体
132
235
  * */
133
236
  const bodyClick = () => {
134
- emit("body-click", props.index);
135
- };
237
+ emit('body-click', props.index)
238
+ }
136
239
  /**
137
240
  * @description 点击尾部
138
241
  * */
139
242
  const footClick = () => {
140
- emit("foot-click", props.index);
141
- };
243
+ emit('foot-click', props.index)
244
+ }
142
245
  </script>
143
246
 
144
247
  <style lang="scss" scoped>
145
- @import "./index.scss";
248
+ @import './index.scss';
146
249
  </style>
@@ -1,112 +1,123 @@
1
- import type { CSSProperties } from "vue";
1
+ import type { CSSProperties } from 'vue'
2
2
 
3
3
  export default interface HyCardProps {
4
4
  /**
5
5
  * @description 卡片与屏幕两侧是否留空隙(默认false)
6
6
  * */
7
- full?: boolean;
7
+ full?: boolean
8
8
  /**
9
9
  * @description 头部左边的标题
10
10
  * */
11
- title?: string;
11
+ title?: string
12
12
  /**
13
13
  * @description 标题颜色(默认#303133)
14
14
  * */
15
- titleColor?: string;
15
+ titleColor?: string
16
16
  /**
17
17
  * @description 标题字体大小,单位rpx(默认15px)
18
18
  * */
19
- titleSize?: string | number;
19
+ titleSize?: string | number
20
20
  /**
21
21
  * @description 头部右边的副标题
22
22
  * */
23
- subTitle?: string;
23
+ subTitle?: string
24
24
  /**
25
25
  * @description 副标题颜色(默认#909399)
26
26
  * */
27
- subTitleColor?: string;
27
+ subTitleColor?: string
28
28
  /**
29
29
  * @description 副标题字体大小(默认13px)
30
30
  * */
31
- subTitleSize?: string | number;
31
+ subTitleSize?: string | number
32
32
  /**
33
33
  * @description 是否显示边框(默认true)
34
34
  * */
35
- border?: boolean;
35
+ border?: boolean
36
36
  /**
37
37
  * @description 用于标识点击了第几个卡片
38
38
  * */
39
- index?: string | number;
39
+ index?: string | number
40
40
  /**
41
41
  * @description 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px"(默认15px)
42
42
  * */
43
- margin?: string;
43
+ margin?: string
44
44
  /**
45
45
  * @description 卡片整体的圆角值,单位px(默认8px)
46
46
  * */
47
- borderRadius?: string | number;
47
+ borderRadius?: string | number
48
48
  /**
49
49
  * @description 头部自定义样式,对象形式
50
50
  * */
51
- headStyle?: CSSProperties;
51
+ headStyle?: CSSProperties
52
52
  /**
53
53
  * @description 中部自定义样式,对象形式
54
54
  * */
55
- bodyStyle?: CSSProperties;
55
+ bodyStyle?: CSSProperties
56
56
  /**
57
57
  * @description 底部自定义样式,对象形式
58
58
  * */
59
- footStyle?: CSSProperties;
59
+ footStyle?: CSSProperties
60
60
  /**
61
61
  * @description 是否显示头部的下边框(默认true)
62
62
  * */
63
- headBorderBottom?: boolean;
63
+ headBorderBottom?: boolean
64
64
  /**
65
65
  * @description 是否显示底部的上边框(默认true)
66
66
  * */
67
- footBorderTop?: boolean;
67
+ footBorderTop?: boolean
68
68
  /**
69
69
  * @description 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径
70
70
  * */
71
- thumb?: string;
71
+ thumb?: string
72
72
  /**
73
73
  * @description 缩略图的宽度,高等于宽,单位px(默认30px)
74
74
  * */
75
- thumbWidth?: string | number;
75
+ thumbWidth?: string | number
76
76
  /**
77
77
  * @description 缩略图是否为圆形(默认false)
78
78
  * */
79
- thumbCircle?: boolean;
79
+ thumbCircle?: boolean
80
80
  /**
81
81
  * @description // 给head,body,foot的内边距
82
82
  * */
83
- padding?: string | number;
83
+ padding?: string | number
84
84
  /**
85
85
  * @description 头部内边距
86
86
  * */
87
- paddingHead?: string | number;
87
+ paddingHead?: string | number
88
88
  /**
89
89
  * @description 中部内边距
90
90
  * */
91
- paddingBody?: string | number;
91
+ paddingBody?: string | number
92
92
  /**
93
93
  * @description 尾部内边距
94
94
  * */
95
- paddingFoot?: string | number;
95
+ paddingFoot?: string | number
96
96
  /**
97
97
  * @description 是否显示头部(默认true)
98
98
  * */
99
- showHead?: boolean;
99
+ showHead?: boolean
100
100
  /**
101
101
  * @description 是否显示尾部(默认true)
102
102
  * */
103
- showFoot?: boolean;
103
+ showFoot?: boolean
104
104
  /**
105
105
  * @description 卡片外围阴影,字符串形式(默认true)
106
106
  * */
107
- boxShadow?: string | boolean;
107
+ boxShadow?: string | boolean
108
108
  /**
109
109
  * @description 定义需要用到的外部样式
110
110
  * */
111
- customStyle?: CSSProperties;
111
+ customStyle?: CSSProperties
112
+ }
113
+
114
+ export interface ICardEmits {
115
+ /** 整个卡片任意位置被点击时触发 */
116
+ (e: 'click', index: number): void
117
+ /** 卡片头部被点击时触发 */
118
+ (e: 'head-click', index: number): void
119
+ /** 卡片主体部分被点击时触发 */
120
+ (e: 'body-click', index: number): void
121
+ /** 卡片底部部分被点击时触发 */
122
+ (e: 'foot-click', index: number): void
112
123
  }