hy-app 0.4.15 → 0.5.1

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 (206) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +155 -238
  2. package/components/hy-action-sheet/props.ts +68 -15
  3. package/components/hy-action-sheet/typing.d.ts +115 -115
  4. package/components/hy-address-picker/hy-address-picker.vue +185 -289
  5. package/components/hy-address-picker/props.ts +97 -21
  6. package/components/hy-address-picker/typing.d.ts +90 -89
  7. package/components/hy-avatar/hy-avatar.vue +121 -204
  8. package/components/hy-avatar/props.ts +76 -18
  9. package/components/hy-avatar/typing.d.ts +63 -62
  10. package/components/hy-back-top/hy-back-top.vue +65 -120
  11. package/components/hy-back-top/props.ts +57 -16
  12. package/components/hy-back-top/typing.d.ts +43 -42
  13. package/components/hy-badge/hy-badge.vue +66 -138
  14. package/components/hy-badge/props.ts +73 -17
  15. package/components/hy-badge/typing.d.ts +59 -58
  16. package/components/hy-button/hy-button.vue +226 -375
  17. package/components/hy-button/props.ts +129 -158
  18. package/components/hy-calendar/header.vue +48 -64
  19. package/components/hy-calendar/hy-calendar.vue +274 -438
  20. package/components/hy-calendar/month.vue +508 -516
  21. package/components/hy-calendar/props.ts +157 -35
  22. package/components/hy-calendar/typing.d.ts +129 -128
  23. package/components/hy-card/hy-card.vue +118 -240
  24. package/components/hy-card/index.scss +1 -2
  25. package/components/hy-card/props.ts +122 -27
  26. package/components/hy-card/typing.d.ts +119 -118
  27. package/components/hy-cell/hy-cell.vue +176 -258
  28. package/components/hy-cell/props.ts +71 -17
  29. package/components/hy-cell/typing.d.ts +87 -86
  30. package/components/hy-check-button/hy-check-button.vue +69 -139
  31. package/components/hy-check-button/props.ts +72 -18
  32. package/components/hy-check-button/typing.d.ts +74 -73
  33. package/components/hy-checkbox/hy-checkbox.vue +170 -263
  34. package/components/hy-checkbox/props.ts +94 -24
  35. package/components/hy-checkbox/typing.d.ts +72 -72
  36. package/components/hy-checkbox-group/hy-checkbox-group.vue +25 -100
  37. package/components/hy-checkbox-group/props.ts +80 -0
  38. package/components/hy-checkbox-group/typing.d.ts +65 -65
  39. package/components/hy-checkbox-item/hy-checkbox-item.vue +140 -177
  40. package/components/hy-checkbox-item/props.ts +24 -0
  41. package/components/hy-checkbox-item/typing.d.ts +4 -3
  42. package/components/hy-code-input/hy-code-input.vue +179 -262
  43. package/components/hy-code-input/props.ts +84 -18
  44. package/components/hy-code-input/typing.d.ts +71 -71
  45. package/components/hy-config-provider/hy-config-provider.vue +28 -50
  46. package/components/hy-config-provider/props.ts +26 -11
  47. package/components/hy-config-provider/typing.d.ts +20 -20
  48. package/components/hy-count-down/hy-count-down.vue +103 -131
  49. package/components/hy-count-down/props.ts +30 -8
  50. package/components/hy-count-down/typing.d.ts +25 -25
  51. package/components/hy-count-to/hy-count-to.vue +148 -213
  52. package/components/hy-count-to/props.ts +60 -15
  53. package/components/hy-count-to/typing.d.ts +46 -46
  54. package/components/hy-coupon/hy-coupon.vue +10 -5
  55. package/components/hy-coupon/index.scss +148 -64
  56. package/components/hy-coupon/props.ts +35 -50
  57. package/components/hy-coupon/typing.d.ts +10 -0
  58. package/components/hy-datetime-picker/hy-datetime-picker.vue +415 -580
  59. package/components/hy-datetime-picker/props.ts +142 -32
  60. package/components/hy-datetime-picker/typing.d.ts +132 -132
  61. package/components/hy-divider/hy-divider.vue +90 -169
  62. package/components/hy-divider/props.ts +78 -19
  63. package/components/hy-divider/typing.d.ts +60 -60
  64. package/components/hy-dropdown/hy-dropdown.vue +37 -71
  65. package/components/hy-dropdown/props.ts +38 -15
  66. package/components/hy-dropdown/typing.d.ts +44 -44
  67. package/components/hy-dropdown-item/hy-dropdown-item.vue +141 -173
  68. package/components/hy-dropdown-item/props.ts +19 -8
  69. package/components/hy-empty/hy-empty.vue +75 -129
  70. package/components/hy-empty/props.ts +57 -15
  71. package/components/hy-empty/typing.d.ts +84 -84
  72. package/components/hy-flex/hy-flex.vue +33 -88
  73. package/components/hy-flex/props.ts +58 -0
  74. package/components/hy-flex/typing.d.ts +14 -16
  75. package/components/hy-float-button/hy-float-button.vue +289 -406
  76. package/components/hy-float-button/props.ts +109 -25
  77. package/components/hy-folding-panel/hy-folding-panel.vue +74 -114
  78. package/components/hy-folding-panel/props.ts +42 -0
  79. package/components/hy-folding-panel/typing.d.ts +57 -57
  80. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +139 -231
  81. package/components/hy-folding-panel-item/props.ts +81 -0
  82. package/components/hy-folding-panel-item/typing.d.ts +23 -23
  83. package/components/hy-form/hy-form.vue +172 -212
  84. package/components/hy-form/props.ts +37 -0
  85. package/components/hy-form/typing.d.ts +68 -61
  86. package/components/hy-form-group/typing.d.ts +74 -74
  87. package/components/hy-form-item/hy-form-item.vue +100 -129
  88. package/components/hy-form-item/props.ts +25 -0
  89. package/components/hy-form-item/typing.d.ts +40 -37
  90. package/components/hy-grid/hy-grid.vue +76 -132
  91. package/components/hy-grid/props.ts +58 -16
  92. package/components/hy-grid/typing.d.ts +66 -66
  93. package/components/hy-icon/hy-icon.vue +84 -161
  94. package/components/hy-icon/props.ts +76 -22
  95. package/components/hy-icon/typing.d.ts +83 -82
  96. package/components/hy-image/hy-image.vue +142 -272
  97. package/components/hy-image/props.ts +105 -23
  98. package/components/hy-image/typing.d.ts +84 -87
  99. package/components/hy-input/hy-input.vue +230 -421
  100. package/components/hy-input/props.ts +183 -35
  101. package/components/hy-input/typing.d.ts +169 -169
  102. package/components/hy-line/hy-line.vue +34 -72
  103. package/components/hy-line/props.ts +41 -10
  104. package/components/hy-line/typing.d.ts +29 -29
  105. package/components/hy-line-progress/hy-line-progress.vue +66 -101
  106. package/components/hy-line-progress/props.ts +31 -10
  107. package/components/hy-line-progress/typing.d.ts +29 -29
  108. package/components/hy-list/hy-list.vue +151 -220
  109. package/components/hy-list/props.ts +67 -16
  110. package/components/hy-list/typing.d.ts +52 -52
  111. package/components/hy-loading/hy-loading.vue +63 -119
  112. package/components/hy-loading/props.ts +63 -15
  113. package/components/hy-loading/typing.d.ts +49 -49
  114. package/components/hy-menu/hy-menu.vue +124 -166
  115. package/components/hy-menu/props.ts +42 -10
  116. package/components/hy-menu/typing.d.ts +60 -60
  117. package/components/hy-modal/hy-modal.vue +127 -218
  118. package/components/hy-modal/props.ts +89 -24
  119. package/components/hy-navbar/hy-navbar.vue +104 -177
  120. package/components/hy-navbar/props.ts +76 -22
  121. package/components/hy-navbar/typing.d.ts +81 -81
  122. package/components/hy-notice-bar/hy-notice-bar.vue +67 -144
  123. package/components/hy-notice-bar/props.ts +80 -19
  124. package/components/hy-notice-bar/typing.d.ts +62 -62
  125. package/components/hy-notify/hy-notify.vue +128 -177
  126. package/components/hy-notify/props.ts +49 -12
  127. package/components/hy-notify/typing.d.ts +45 -41
  128. package/components/hy-number-step/hy-number-step.vue +281 -394
  129. package/components/hy-number-step/props.ts +110 -27
  130. package/components/hy-number-step/typing.d.ts +120 -120
  131. package/components/hy-overlay/hy-overlay.vue +39 -66
  132. package/components/hy-overlay/props.ts +31 -8
  133. package/components/hy-pagination/hy-pagination.vue +100 -155
  134. package/components/hy-pagination/props.ts +53 -13
  135. package/components/hy-picker/hy-picker.vue +309 -430
  136. package/components/hy-picker/index.scss +8 -12
  137. package/components/hy-picker/props.ts +110 -26
  138. package/components/hy-popover/hy-popover.vue +190 -252
  139. package/components/hy-popover/props.ts +48 -10
  140. package/components/hy-popup/hy-popup.vue +162 -248
  141. package/components/hy-popup/props.ts +82 -18
  142. package/components/hy-price/hy-price.vue +45 -104
  143. package/components/hy-price/props.ts +52 -12
  144. package/components/hy-price/typing.d.ts +41 -36
  145. package/components/hy-qrcode/hy-qrcode.vue +115 -185
  146. package/components/hy-qrcode/props.ts +68 -18
  147. package/components/hy-qrcode/typing.d.ts +67 -66
  148. package/components/hy-radio/hy-radio.vue +161 -259
  149. package/components/hy-radio/props.ts +95 -25
  150. package/components/hy-radio/typing.d.ts +85 -84
  151. package/components/hy-rate/hy-rate.vue +185 -270
  152. package/components/hy-rate/props.ts +76 -18
  153. package/components/hy-rate/typing.d.ts +61 -60
  154. package/components/hy-read-more/hy-read-more.vue +93 -136
  155. package/components/hy-read-more/props.ts +43 -13
  156. package/components/hy-scroll-list/hy-scroll-list.vue +81 -102
  157. package/components/hy-scroll-list/props.ts +22 -11
  158. package/components/hy-search/hy-search.vue +155 -284
  159. package/components/hy-search/props.ts +130 -25
  160. package/components/hy-signature/hy-signature.vue +491 -635
  161. package/components/hy-signature/props.ts +115 -26
  162. package/components/hy-signature/typing.d.ts +138 -138
  163. package/components/hy-slider/hy-slider.vue +388 -477
  164. package/components/hy-slider/props.ts +75 -19
  165. package/components/hy-steps/hy-steps.vue +212 -279
  166. package/components/hy-steps/props.ts +47 -13
  167. package/components/hy-submit-bar/hy-submit-bar.vue +136 -221
  168. package/components/hy-submit-bar/props.ts +89 -20
  169. package/components/hy-submit-bar/typing.d.ts +87 -87
  170. package/components/hy-subsection/hy-subsection.vue +132 -185
  171. package/components/hy-subsection/props.ts +50 -17
  172. package/components/hy-subsection/typing.d.ts +52 -52
  173. package/components/hy-swipe-action/hy-swipe-action.vue +228 -283
  174. package/components/hy-swipe-action/props.ts +43 -18
  175. package/components/hy-swipe-action/typing.d.ts +46 -46
  176. package/components/hy-swiper/hy-swiper.vue +159 -286
  177. package/components/hy-swiper/props.ts +126 -28
  178. package/components/hy-swiper/typing.d.ts +115 -115
  179. package/components/hy-switch/hy-switch.vue +112 -176
  180. package/components/hy-switch/props.ts +60 -15
  181. package/components/hy-switch/typing.d.ts +63 -63
  182. package/components/hy-tabBar/hy-tabBar.vue +64 -60
  183. package/components/hy-tabs/hy-tabs.vue +277 -380
  184. package/components/hy-tabs/props.ts +75 -18
  185. package/components/hy-tag/hy-tag.vue +111 -204
  186. package/components/hy-tag/props.ts +81 -19
  187. package/components/hy-text/hy-text.vue +200 -322
  188. package/components/hy-text/props.ts +107 -28
  189. package/components/hy-textarea/hy-textarea.vue +147 -256
  190. package/components/hy-textarea/props.ts +112 -25
  191. package/components/hy-textarea/typing.d.ts +42 -42
  192. package/components/hy-toast/hy-toast.vue +135 -143
  193. package/components/hy-tooltip/hy-tooltip.vue +220 -306
  194. package/components/hy-tooltip/props.ts +79 -15
  195. package/components/hy-transition/hy-transition.vue +111 -138
  196. package/components/hy-transition/props.ts +30 -8
  197. package/components/hy-upload/hy-upload.vue +320 -469
  198. package/components/hy-upload/props.ts +130 -27
  199. package/components/hy-warn/hy-warn.vue +80 -129
  200. package/components/hy-warn/props.ts +47 -12
  201. package/components/hy-waterfall/hy-waterfall.vue +139 -163
  202. package/components/hy-waterfall/props.ts +19 -7
  203. package/components/hy-watermark/hy-watermark.vue +762 -870
  204. package/components/hy-watermark/props.ts +103 -22
  205. package/package.json +2 -2
  206. package/web-types.json +1 -1
@@ -1,264 +1,173 @@
1
1
  <template>
2
- <HyPopup
3
- mode="center"
4
- :zoom="zoom"
5
- :show="modelValue"
6
- :round="round"
7
- :customStyle="{
8
- overflow: 'hidden',
9
- marginTop: `-${addUnit(negativeTop)}`,
10
- }"
11
- :closeOnClickOverlay="closeOnClickOverlay"
12
- :safeAreaInsetBottom="false"
13
- :duration="400"
14
- @click="clickHandler"
15
- >
16
- <view
17
- class="hy-modal"
18
- :style="{
19
- width: addUnit(width),
20
- }"
21
- >
22
- <view class="hy-modal__title" v-if="title">{{ title }}</view>
23
- <view
24
- class="hy-modal__content"
25
- :style="{
26
- paddingTop: `${title ? 12 : 25}px`,
2
+ <HyPopup
3
+ mode="center"
4
+ :zoom="zoom"
5
+ :show="modelValue"
6
+ :round="round"
7
+ :customStyle="{
8
+ overflow: 'hidden',
9
+ marginTop: `-${addUnit(negativeTop)}`
27
10
  }"
28
- >
29
- <slot>
30
- <text class="hy-modal__content--text">
31
- {{ content }}
32
- </text>
33
- </slot>
34
- </view>
35
- <view
36
- class="hy-modal__button--group__confirm-button"
37
- v-if="$slots.confirmButton"
38
- >
39
- <slot name="confirmButton"></slot>
40
- </view>
41
- <template v-else>
11
+ :closeOnClickOverlay="closeOnClickOverlay"
12
+ :safeAreaInsetBottom="false"
13
+ :duration="400"
14
+ @click="clickHandler"
15
+ >
42
16
  <view
43
- :class="[
44
- 'hy-modal__button--group',
45
- showCancelButton &&
46
- showConfirmButton &&
47
- (!buttonReverse
48
- ? 'hy-modal__button--exact'
49
- : 'hy-modal__button--exact--reverse'),
50
- ]"
51
- :style="{
52
- flexDirection: buttonReverse ? 'row-reverse' : 'row',
53
- }"
17
+ class="hy-modal"
18
+ :style="{
19
+ width: addUnit(width)
20
+ }"
54
21
  >
55
- <view
56
- class="hy-modal__button--group__wrapper first hy-modal__button--group__wrapper--cancel"
57
- :hover-stay-time="150"
58
- hover-class="hy-modal__button--group__wrapper--hover"
59
- v-if="showCancelButton"
60
- @tap.stop="cancelHandler"
61
- >
62
- <text
63
- class="hy-modal__button--group__wrapper--text hy-modal__button--group__wrapper--cancel__text"
64
- :style="{
65
- color: cancelColor,
66
- }"
22
+ <view class="hy-modal__title" v-if="title">{{ title }}</view>
23
+ <view
24
+ class="hy-modal__content"
25
+ :style="{
26
+ paddingTop: `${title ? 12 : 25}px`
27
+ }"
67
28
  >
68
- {{ cancelText }}
69
- </text>
70
- </view>
71
- <view
72
- class="hy-modal__button--group__wrapper last hy-modal__button--group__wrapper--confirm"
73
- :hover-stay-time="150"
74
- hover-class="hy-modal__button--group__wrapper--hover"
75
- v-if="showConfirmButton"
76
- @tap="confirmHandler"
77
- >
78
- <HyLoading v-if="load" mode="circle"></HyLoading>
79
- <text
80
- v-else
81
- class="hy-modal__button--group__wrapper--text hy-modal__button--group__wrapper--confirm__text"
82
- :style="{
83
- color: confirmColor,
84
- }"
85
- >
86
- {{ confirmText }}
87
- </text>
88
- </view>
29
+ <slot v-if="$slots.default"></slot>
30
+ <text v-else class="hy-modal__content--text">
31
+ {{ content }}
32
+ </text>
33
+ </view>
34
+ <view class="hy-modal__button--group__confirm-button" v-if="$slots.confirmButton">
35
+ <slot name="confirmButton"></slot>
36
+ </view>
37
+ <template v-else>
38
+ <view
39
+ :class="[
40
+ 'hy-modal__button--group',
41
+ showCancelButton &&
42
+ showConfirmButton &&
43
+ (!buttonReverse
44
+ ? 'hy-modal__button--exact'
45
+ : 'hy-modal__button--exact--reverse')
46
+ ]"
47
+ :style="{
48
+ flexDirection: buttonReverse ? 'row-reverse' : 'row'
49
+ }"
50
+ >
51
+ <view
52
+ class="hy-modal__button--group__wrapper first hy-modal__button--group__wrapper--cancel"
53
+ :hover-stay-time="150"
54
+ hover-class="hy-modal__button--group__wrapper--hover"
55
+ v-if="showCancelButton"
56
+ @tap.stop="cancelHandler"
57
+ >
58
+ <text
59
+ class="hy-modal__button--group__wrapper--text hy-modal__button--group__wrapper--cancel__text"
60
+ :style="{
61
+ color: cancelColor
62
+ }"
63
+ >
64
+ {{ cancelText }}
65
+ </text>
66
+ </view>
67
+ <view
68
+ class="hy-modal__button--group__wrapper last hy-modal__button--group__wrapper--confirm"
69
+ :hover-stay-time="150"
70
+ hover-class="hy-modal__button--group__wrapper--hover"
71
+ v-if="showConfirmButton"
72
+ @tap="confirmHandler"
73
+ >
74
+ <hy-loading v-if="load" mode="circle"></hy-loading>
75
+ <text
76
+ v-else
77
+ class="hy-modal__button--group__wrapper--text hy-modal__button--group__wrapper--confirm__text"
78
+ :style="{
79
+ color: confirmColor
80
+ }"
81
+ >
82
+ {{ confirmText }}
83
+ </text>
84
+ </view>
85
+ </view>
86
+ </template>
89
87
  </view>
90
- </template>
91
- </view>
92
- </HyPopup>
88
+ </HyPopup>
93
89
  </template>
94
90
 
95
91
  <script lang="ts">
96
92
  export default {
97
- name: "hy-modal",
98
- options: {
99
- addGlobalClass: true,
100
- virtualHost: true,
101
- styleIsolation: "shared",
102
- },
103
- };
93
+ name: 'hy-modal',
94
+ options: {
95
+ addGlobalClass: true,
96
+ virtualHost: true,
97
+ styleIsolation: 'shared'
98
+ }
99
+ }
104
100
  </script>
105
101
 
106
102
  <script setup lang="ts">
107
- import { ref, watch } from "vue";
108
- import type { IModalEmits } from "./typing";
109
- import { addUnit, sleep } from "../../libs";
103
+ import { ref, watch } from 'vue'
104
+ import type { IModalEmits } from './typing'
105
+ import { addUnit, sleep } from '../../libs'
106
+ import modalProps from './props'
110
107
  // 组件
111
- import HyPopup from "../hy-popup/hy-popup.vue";
112
- import HyLoading from "../hy-loading/hy-loading.vue";
108
+ import HyPopup from '../hy-popup/hy-popup.vue'
109
+ import HyLoading from '../hy-loading/hy-loading.vue'
113
110
 
114
111
  /**
115
112
  * 弹出模态框,常用于消息提示、消息确认、在当前页面内完成特定的交互操作。
116
113
  * @displayName hy-modal
117
114
  */
118
- defineOptions({});
115
+ defineOptions({})
119
116
 
120
- // const props = withDefaults(defineProps<IProps>(), defaultProps)
121
- const props = defineProps({
122
- /** 是否显示模态框 */
123
- modelValue: {
124
- type: Boolean,
125
- default: false,
126
- },
127
- /** 标题内容 */
128
- title: String,
129
- /** 模态框内容,如传入slot内容,则此参数无效 */
130
- content: String,
131
- /** 确认按钮的文字 */
132
- confirmText: {
133
- type: String,
134
- default: "确认",
135
- },
136
- /** 取消按钮的文字 */
137
- cancelText: {
138
- type: String,
139
- default: "取消",
140
- },
141
- /** 是否显示确认按钮 */
142
- showConfirmButton: {
143
- type: Boolean,
144
- default: true,
145
- },
146
- /** 是否显示取消按钮 */
147
- showCancelButton: {
148
- type: Boolean,
149
- default: false,
150
- },
151
- /** 确认按钮的颜色 */
152
- confirmColor: String,
153
- /** 取消按钮的颜色 */
154
- cancelColor: String,
155
- /** 对调确认和取消的位置 */
156
- buttonReverse: {
157
- type: Boolean,
158
- default: false,
159
- },
160
- /** 是否开启缩放模式 */
161
- zoom: {
162
- type: Boolean,
163
- default: true,
164
- },
165
- /** 弹窗的圆角 */
166
- round: {
167
- type: [String, Number],
168
- default: 16,
169
- },
170
- /** 点击确认按钮自动关闭 */
171
- autoClose: {
172
- type: Boolean,
173
- default: true,
174
- },
175
- /** 加载按钮 */
176
- loading: {
177
- type: Boolean,
178
- default: false,
179
- },
180
- /** 是否允许点击遮罩关闭Modal */
181
- closeOnClickOverlay: {
182
- type: Boolean,
183
- default: false,
184
- },
185
- /** 往上偏移的值,给一个负的margin-top,往上偏移,避免和键盘重合的情况,单位任意,数值则默认为px单位 */
186
- negativeTop: {
187
- type: Number,
188
- default: 0,
189
- },
190
- /** modal宽度,不支持百分比,可以数值,px,rpx单位 */
191
- width: {
192
- type: [String, Number],
193
- default: "550rpx",
194
- },
195
- /**
196
- * 确认按钮的样式,如设置,将不会显示取消按钮
197
- * @values circle,square
198
- * */
199
- confirmButtonShape: String,
200
- /**
201
- * 文案对齐方式
202
- * @values left,center,right
203
- * */
204
- contentTextAlign: {
205
- type: String,
206
- default: "left",
207
- },
208
- });
209
- const emit = defineEmits<IModalEmits>();
210
- const load = ref(props.loading);
117
+ const props = defineProps(modalProps)
118
+ const emit = defineEmits<IModalEmits>()
119
+ const load = ref(props.loading)
211
120
 
212
121
  watch(
213
- () => props.loading,
214
- (newVal) => {
215
- load.value = props.loading;
216
- },
217
- );
122
+ () => props.loading,
123
+ (newVal) => {
124
+ load.value = props.loading
125
+ }
126
+ )
218
127
 
219
128
  watch(
220
- () => props.modelValue,
221
- (newVal) => {
222
- if (!newVal) load.value = false;
223
- },
224
- );
129
+ () => props.modelValue,
130
+ (newVal) => {
131
+ if (!newVal) load.value = false
132
+ }
133
+ )
225
134
 
226
135
  /**
227
136
  * @description 点击确定按钮
228
137
  * */
229
138
  const confirmHandler = async () => {
230
- if (load.value) return;
231
- // 如果配置了异步关闭,将按钮值为loading状态
232
- emit("confirm");
139
+ if (load.value) return
140
+ // 如果配置了异步关闭,将按钮值为loading状态
141
+ emit('confirm')
233
142
 
234
- await sleep();
235
- if (!props.loading && props.autoClose) {
236
- emit("update:modelValue", false);
237
- }
238
- };
143
+ await sleep()
144
+ if (!props.loading && props.autoClose) {
145
+ emit('update:modelValue', false)
146
+ }
147
+ }
239
148
 
240
149
  /**
241
150
  * @description 点击取消按钮
242
151
  * */
243
152
  const cancelHandler = () => {
244
- emit("update:modelValue", false);
245
- emit("cancel");
246
- };
153
+ emit('update:modelValue', false)
154
+ emit('cancel')
155
+ }
247
156
 
248
157
  /**
249
158
  * @description 点击遮罩
250
159
  * */
251
160
  const clickHandler = () => {
252
- if (props.closeOnClickOverlay) {
253
- emit("update:modelValue", false);
254
- emit("close");
255
- }
256
- };
161
+ if (props.closeOnClickOverlay) {
162
+ emit('update:modelValue', false)
163
+ emit('close')
164
+ }
165
+ }
257
166
  </script>
258
167
 
259
168
  <style lang="scss" scoped>
260
- @import "./index.scss";
169
+ @import './index.scss';
261
170
  .modal__content__text {
262
- text-align: v-bind(contentTextAlign);
171
+ text-align: v-bind(contentTextAlign);
263
172
  }
264
173
  </style>
@@ -1,25 +1,90 @@
1
- import type IProps from "./typing";
2
- import { ColorConfig } from "../../libs";
1
+ const modalProps = {
2
+ /** 是否显示模态框 */
3
+ modelValue: {
4
+ type: Boolean,
5
+ default: false
6
+ },
7
+ /** 标题内容 */
8
+ title: String,
9
+ /** 模态框内容,如传入slot内容,则此参数无效 */
10
+ content: String,
11
+ /** 确认按钮的文字 */
12
+ confirmText: {
13
+ type: String,
14
+ default: '确认'
15
+ },
16
+ /** 取消按钮的文字 */
17
+ cancelText: {
18
+ type: String,
19
+ default: '取消'
20
+ },
21
+ /** 是否显示确认按钮 */
22
+ showConfirmButton: {
23
+ type: Boolean,
24
+ default: true
25
+ },
26
+ /** 是否显示取消按钮 */
27
+ showCancelButton: {
28
+ type: Boolean,
29
+ default: false
30
+ },
31
+ /** 确认按钮的颜色 */
32
+ confirmColor: String,
33
+ /** 取消按钮的颜色 */
34
+ cancelColor: String,
35
+ /** 对调确认和取消的位置 */
36
+ buttonReverse: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ /** 是否开启缩放模式 */
41
+ zoom: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ /** 弹窗的圆角 */
46
+ round: {
47
+ type: [String, Number],
48
+ default: 16
49
+ },
50
+ /** 点击确认按钮自动关闭 */
51
+ autoClose: {
52
+ type: Boolean,
53
+ default: true
54
+ },
55
+ /** 加载按钮 */
56
+ loading: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ /** 是否允许点击遮罩关闭Modal */
61
+ closeOnClickOverlay: {
62
+ type: Boolean,
63
+ default: false
64
+ },
65
+ /** 往上偏移的值,给一个负的margin-top,往上偏移,避免和键盘重合的情况,单位任意,数值则默认为px单位 */
66
+ negativeTop: {
67
+ type: Number,
68
+ default: 0
69
+ },
70
+ /** modal宽度,不支持百分比,可以数值,px,rpx单位 */
71
+ width: {
72
+ type: [String, Number],
73
+ default: '550rpx'
74
+ },
75
+ /**
76
+ * 确认按钮的样式,如设置,将不会显示取消按钮
77
+ * @values circle,square
78
+ * */
79
+ confirmButtonShape: String,
80
+ /**
81
+ * 文案对齐方式
82
+ * @values left,center,right
83
+ * */
84
+ contentTextAlign: {
85
+ type: String,
86
+ default: 'left'
87
+ }
88
+ }
3
89
 
4
- const defaultProps: IProps = {
5
- modelValue: false,
6
- title: "",
7
- content: "",
8
- confirmText: "确认",
9
- cancelText: "取消",
10
- showConfirmButton: true,
11
- showCancelButton: false,
12
- confirmColor: "",
13
- cancelColor: "",
14
- buttonReverse: false,
15
- zoom: true,
16
- round: 16,
17
- asyncClose: false,
18
- closeOnClickOverlay: false,
19
- negativeTop: 0,
20
- width: "550rpx",
21
- confirmButtonShape: "",
22
- contentTextAlign: "left",
23
- };
24
-
25
- export default defaultProps;
90
+ export default modalProps