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.
- package/components/hy-action-sheet/hy-action-sheet.vue +81 -13
- package/components/hy-action-sheet/typing.d.ts +1 -3
- package/components/hy-address-picker/hy-address-picker.vue +109 -8
- package/components/hy-address-picker/index.scss +2 -2
- package/components/hy-address-picker/typing.d.ts +39 -30
- package/components/hy-avatar/hy-avatar.vue +78 -4
- package/components/hy-avatar/typing.d.ts +21 -16
- package/components/hy-back-top/hy-back-top.vue +86 -28
- package/components/hy-back-top/typing.d.ts +17 -12
- package/components/hy-badge/hy-badge.vue +114 -43
- package/components/hy-badge/typing.d.ts +20 -15
- package/components/hy-button/HyButton.docgen.js +6 -0
- package/components/hy-button/hy-button.vue +70 -77
- package/components/hy-button/props.ts +40 -41
- package/components/hy-calendar/hy-calendar.vue +290 -143
- package/components/hy-calendar/typing.d.ts +38 -31
- package/components/hy-card/hy-card.vue +139 -36
- package/components/hy-card/typing.d.ts +39 -28
- package/components/hy-cell/hy-cell.vue +131 -67
- package/components/hy-cell/typing.d.ts +6 -1
- package/components/hy-check-button/hy-check-button.vue +101 -32
- package/components/hy-check-button/typing.d.ts +26 -19
- package/components/hy-checkbox/hy-checkbox.vue +167 -78
- package/components/hy-checkbox/typing.d.ts +26 -19
- package/components/hy-code-input/hy-code-input.vue +101 -5
- package/components/hy-code-input/typing.d.ts +9 -0
- package/components/hy-config-provider/hy-config-provider.vue +44 -24
- package/components/hy-config-provider/typing.d.ts +0 -4
- package/components/hy-count-down/hy-count-down.vue +99 -62
- package/components/hy-count-down/typing.d.ts +18 -5
- package/components/hy-count-to/hy-count-to.vue +165 -113
- package/components/hy-count-to/typing.d.ts +15 -11
- package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
- package/components/hy-datetime-picker/typing.d.ts +49 -39
- package/components/hy-divider/hy-divider.vue +128 -64
- package/components/hy-divider/typing.d.ts +16 -16
- package/components/hy-dropdown/hy-dropdown.vue +57 -19
- package/components/hy-dropdown/typing.d.ts +14 -14
- package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
- package/components/hy-dropdown-item/typing.d.ts +13 -6
- package/components/hy-empty/hy-empty.vue +64 -6
- package/components/hy-empty/typing.d.ts +5 -0
- package/components/hy-float-button/hy-float-button.vue +117 -5
- package/components/hy-float-button/typing.d.ts +7 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
- package/components/hy-folding-panel/typing.d.ts +24 -15
- package/components/hy-grid/hy-grid.vue +95 -35
- package/components/hy-grid/typing.d.ts +24 -19
- package/components/hy-icon/hy-icon.vue +84 -6
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-image/hy-image.vue +105 -6
- package/components/hy-image/typing.d.ts +9 -0
- package/components/hy-input/hy-input.vue +277 -130
- package/components/hy-input/props.ts +13 -14
- package/components/hy-input/typing.d.ts +59 -38
- package/components/hy-line/hy-line.vue +65 -25
- package/components/hy-line-progress/hy-line-progress.vue +68 -35
- package/components/hy-list/hy-list.vue +127 -61
- package/components/hy-list/typing.d.ts +19 -12
- package/components/hy-loading/hy-loading.vue +79 -25
- package/components/hy-menu/hy-menu.vue +69 -45
- package/components/hy-menu/typing.d.ts +22 -15
- package/components/hy-modal/hy-modal.vue +91 -4
- package/components/hy-modal/typing.d.ts +11 -0
- package/components/hy-navbar/hy-navbar.vue +105 -25
- package/components/hy-navbar/typing.d.ts +25 -20
- package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
- package/components/hy-notice-bar/typing.d.ts +22 -17
- package/components/hy-notify/hy-notify.vue +106 -54
- package/components/hy-number-step/hy-number-step.vue +211 -120
- package/components/hy-number-step/typing.d.ts +45 -28
- package/components/hy-overlay/hy-overlay.vue +60 -16
- package/components/hy-overlay/typing.d.ts +11 -6
- package/components/hy-pagination/hy-pagination.vue +94 -37
- package/components/hy-pagination/typing.d.ts +20 -11
- package/components/hy-picker/hy-picker.vue +225 -160
- package/components/hy-picker/typing.d.ts +51 -28
- package/components/hy-popover/hy-popover.vue +55 -7
- package/components/hy-popover/typing.d.ts +21 -1
- package/components/hy-popup/hy-popup.vue +164 -99
- package/components/hy-popup/typing.d.ts +11 -0
- package/components/hy-price/hy-price.vue +77 -30
- package/components/hy-price/typing.d.ts +10 -10
- package/components/hy-qrcode/hy-qrcode.vue +75 -5
- package/components/hy-qrcode/typing.d.ts +25 -16
- package/components/hy-radio/hy-radio.vue +169 -88
- package/components/hy-radio/typing.d.ts +29 -22
- package/components/hy-rate/hy-rate.vue +155 -104
- package/components/hy-rate/typing.d.ts +23 -16
- package/components/hy-read-more/hy-read-more.vue +83 -56
- package/components/hy-read-more/typing.d.ts +18 -11
- package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
- package/components/hy-scroll-list/typing.d.ts +14 -7
- package/components/hy-search/hy-search.vue +168 -62
- package/components/hy-search/typing.d.ts +47 -26
- package/components/hy-signature/hy-signature.vue +354 -272
- package/components/hy-signature/typing.d.ts +65 -52
- package/components/hy-slider/hy-slider.vue +208 -160
- package/components/hy-slider/typing.d.ts +28 -17
- package/components/hy-steps/hy-steps.vue +125 -99
- package/components/hy-steps/typing.d.ts +21 -14
- package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
- package/components/hy-submit-bar/typing.d.ts +30 -23
- package/components/hy-subsection/hy-subsection.vue +139 -96
- package/components/hy-subsection/typing.d.ts +23 -16
- package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
- package/components/hy-swipe-action/typing.d.ts +26 -17
- package/components/hy-swiper/hy-swiper.vue +178 -73
- package/components/hy-swiper/typing.d.ts +37 -28
- package/components/hy-switch/hy-switch.vue +107 -60
- package/components/hy-switch/typing.d.ts +25 -18
- package/components/hy-tabs/hy-tabs.vue +170 -160
- package/components/hy-tabs/typing.d.ts +36 -22
- package/components/hy-tag/hy-tag.vue +133 -58
- package/components/hy-tag/typing.d.ts +26 -18
- package/components/hy-text/hy-text.vue +106 -6
- package/components/hy-text/typing.d.ts +31 -26
- package/components/hy-textarea/hy-textarea.vue +183 -89
- package/components/hy-textarea/typing.d.ts +41 -24
- package/components/hy-tooltip/hy-tooltip.vue +145 -101
- package/components/hy-tooltip/typing.d.ts +18 -13
- package/components/hy-transition/hy-transition.vue +48 -13
- package/components/hy-transition/typing.d.ts +17 -0
- package/components/hy-upload/hy-upload.vue +113 -148
- package/components/hy-upload/typing.d.ts +71 -71
- package/components/hy-warn/hy-warn.vue +79 -36
- package/components/hy-warn/typing.d.ts +18 -11
- package/components/hy-waterfall/hy-waterfall.vue +90 -77
- package/components/hy-watermark/hy-watermark.vue +82 -5
- package/components/hy-watermark/typing.d.ts +20 -20
- package/global.d.ts +39 -59
- package/package.json +5 -13
- package/utils/inspect.ts +3 -1
- package/web-types.json +1 -1
- package/component-helper.ts +0 -177
- package/components.json +0 -3287
- package/dist/attributes.json +0 -1
- package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
- package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
- package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
- package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
- package/dist/docs/components/hy-badge/hy-badge.md +0 -13
- package/dist/docs/components/hy-button/hy-button.md +0 -61
- package/dist/docs/components/hy-calendar/header.md +0 -17
- package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
- package/dist/docs/components/hy-calendar/month.md +0 -38
- package/dist/docs/components/hy-card/hy-card.md +0 -24
- package/dist/docs/components/hy-cell/hy-cell.md +0 -26
- package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
- package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
- package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
- package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
- package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
- package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
- package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
- package/dist/docs/components/hy-divider/hy-divider.md +0 -13
- package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
- package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
- package/dist/docs/components/hy-empty/hy-empty.md +0 -20
- package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
- package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
- package/dist/docs/components/hy-form/hy-form.md +0 -29
- package/dist/docs/components/hy-grid/hy-grid.md +0 -19
- package/dist/docs/components/hy-icon/hy-icon.md +0 -13
- package/dist/docs/components/hy-image/hy-image.md +0 -22
- package/dist/docs/components/hy-input/hy-input.md +0 -29
- package/dist/docs/components/hy-line/hy-line.md +0 -7
- package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
- package/dist/docs/components/hy-list/hy-list.md +0 -25
- package/dist/docs/components/hy-loading/hy-loading.md +0 -14
- package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
- package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
- package/dist/docs/components/hy-login/hy-login.md +0 -14
- package/dist/docs/components/hy-menu/hy-menu.md +0 -21
- package/dist/docs/components/hy-modal/hy-modal.md +0 -23
- package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
- package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
- package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
- package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
- package/dist/docs/components/hy-notify/hy-notify.md +0 -23
- package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
- package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
- package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
- package/dist/docs/components/hy-parse/hy-parse.md +0 -46
- package/dist/docs/components/hy-parse/node/node.md +0 -7
- package/dist/docs/components/hy-picker/hy-picker.md +0 -32
- package/dist/docs/components/hy-popover/hy-popover.md +0 -34
- package/dist/docs/components/hy-popup/hy-popup.md +0 -22
- package/dist/docs/components/hy-price/hy-price.md +0 -13
- package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
- package/dist/docs/components/hy-radio/hy-radio.md +0 -21
- package/dist/docs/components/hy-rate/hy-rate.md +0 -14
- package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
- package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
- package/dist/docs/components/hy-search/hy-search.md +0 -27
- package/dist/docs/components/hy-signature/hy-signature.md +0 -45
- package/dist/docs/components/hy-slider/hy-slider.md +0 -24
- package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
- package/dist/docs/components/hy-steps/hy-steps.md +0 -23
- package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
- package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
- package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
- package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
- package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
- package/dist/docs/components/hy-switch/hy-switch.md +0 -20
- package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
- package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
- package/dist/docs/components/hy-tag/hy-tag.md +0 -21
- package/dist/docs/components/hy-text/hy-text.md +0 -13
- package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
- package/dist/docs/components/hy-toast/hy-toast.md +0 -17
- package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
- package/dist/docs/components/hy-transition/hy-transition.md +0 -25
- package/dist/docs/components/hy-upload/hy-upload.md +0 -25
- package/dist/docs/components/hy-warn/hy-warn.md +0 -14
- package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
- package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
- package/dist/docs/components/message/TheMessage.md +0 -17
- package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
- package/dist/tags.json +0 -1
- package/dist/web-types.json +0 -1
- package/docgen.config.js +0 -14
- package/web-types.config.js +0 -7
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
2
|
|
|
3
3
|
export interface FileVo {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 上传文件本地地址链接
|
|
6
6
|
* */
|
|
7
|
-
url?: string
|
|
7
|
+
url?: string
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 上传文件类型
|
|
10
10
|
* */
|
|
11
|
-
type?:
|
|
11
|
+
type?: 'image' | 'video' | 'file'
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 上传文件本地地址链接
|
|
14
14
|
* */
|
|
15
|
-
thumb?: string
|
|
15
|
+
thumb?: string
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 文件大小
|
|
18
18
|
* */
|
|
19
|
-
size?: number
|
|
19
|
+
size?: number
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 是否视频
|
|
22
22
|
* */
|
|
23
|
-
isVideo?: boolean
|
|
23
|
+
isVideo?: boolean
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 是否图片
|
|
26
26
|
* */
|
|
27
|
-
isImage?: boolean
|
|
27
|
+
isImage?: boolean
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* 是否显示删除按钮
|
|
30
30
|
* */
|
|
31
|
-
deletable?: boolean
|
|
31
|
+
deletable?: boolean
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* 上传时候状态
|
|
34
34
|
* */
|
|
35
|
-
status?:
|
|
35
|
+
status?: 'loading' | 'failed' | 'success'
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 提示信息
|
|
38
38
|
* */
|
|
39
|
-
message?: string
|
|
39
|
+
message?: string
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* 进度条
|
|
42
42
|
* */
|
|
43
|
-
schedule?: string | number
|
|
43
|
+
schedule?: string | number
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export default interface HyUploadProps {
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* 接受的文件类型, 可选值为all media image file video (默认 'image' )
|
|
49
49
|
* */
|
|
50
|
-
accept?: HyApp.FileType
|
|
50
|
+
accept?: HyApp.FileType
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。
|
|
53
53
|
* */
|
|
54
|
-
extension?: string[]
|
|
54
|
+
extension?: string[]
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* 图片或视频拾取模式,当accept为image类型时设置capture可选额外camera可以直接调起摄像头(默认 ['album', 'camera'] )
|
|
57
57
|
* */
|
|
58
|
-
capture?: (
|
|
58
|
+
capture?: ('album' | 'camera')[]
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* 当accept为video时生效,是否压缩视频,默认为true(默认 true )
|
|
61
61
|
* */
|
|
62
|
-
compressed?: boolean
|
|
62
|
+
compressed?: boolean
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* 当accept为video时生效,可选值为back或front(默认 'back' )
|
|
65
65
|
* */
|
|
66
|
-
camera?:
|
|
66
|
+
camera?: 'back' | 'front'
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* 当accept为video时生效,拍摄视频最长拍摄时间,单位秒(默认 60 )
|
|
69
69
|
* */
|
|
70
|
-
maxDuration?: number
|
|
70
|
+
maxDuration?: number
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* 上传区域的图标,只能内置图标(默认 'camera-fill' )
|
|
73
73
|
* */
|
|
74
|
-
uploadIcon?: string
|
|
74
|
+
uploadIcon?: string
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* 上传区域的图标的字体颜色,只能内置图标(默认 #D3D4D6 )
|
|
77
77
|
* */
|
|
78
|
-
uploadIconColor?: string
|
|
78
|
+
uploadIconColor?: string
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* 是否开启文件读取前事件(默认 false )
|
|
81
81
|
* */
|
|
82
|
-
useBeforeRead?: boolean
|
|
82
|
+
useBeforeRead?: boolean
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* 是否显示组件自带的图片预览功能(默认 true )
|
|
85
85
|
* */
|
|
86
|
-
previewFullImage?: boolean
|
|
86
|
+
previewFullImage?: boolean
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* 最大上传数量(默认 52 )
|
|
89
89
|
* */
|
|
90
|
-
maxCount?: number
|
|
90
|
+
maxCount?: number
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* 是否启用(默认 false )
|
|
93
93
|
* */
|
|
94
|
-
disabled?: boolean
|
|
94
|
+
disabled?: boolean
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
96
|
+
* 预览上传的图片时的裁剪模式,和image组件mode属性一致(默认 'aspectFill' )
|
|
97
97
|
* */
|
|
98
|
-
imageMode?:
|
|
98
|
+
imageMode?: 'aspectFill' | 'aspectFit' | 'widthFix'
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
100
|
+
* 标识符,可以在回调函数的第二项参数中获取
|
|
101
101
|
* */
|
|
102
|
-
name?: string
|
|
102
|
+
name?: string
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* 所选的图片的尺寸, 可选值为original compressed(默认 ['original', 'compressed'] )
|
|
105
105
|
* */
|
|
106
|
-
sizeType?: (
|
|
106
|
+
sizeType?: ('original' | 'compressed')[]
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* 是否开启图片多选,部分安卓机型不支持 (默认 false )
|
|
109
109
|
* */
|
|
110
|
-
multiple?: boolean
|
|
110
|
+
multiple?: boolean
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* 是否展示删除按钮(默认 true )
|
|
113
113
|
* */
|
|
114
|
-
deletable?: boolean
|
|
114
|
+
deletable?: boolean
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
116
|
+
* 文件大小限制,单位为byte (默认 Number.MAX_VALUE )
|
|
117
117
|
* */
|
|
118
|
-
maxSize?: number
|
|
118
|
+
maxSize?: number
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
120
|
+
* 显示已上传的文件列表
|
|
121
121
|
* */
|
|
122
|
-
fileList?: FileVo[]
|
|
122
|
+
fileList?: FileVo[]
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* 上传区域的提示文字
|
|
125
125
|
* */
|
|
126
|
-
uploadText?: string
|
|
126
|
+
uploadText?: string
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* 内部预览图片区域和选择图片按钮的区域宽度(默认 80 )
|
|
129
129
|
* */
|
|
130
|
-
width?: string | number
|
|
130
|
+
width?: string | number
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
132
|
+
* 内部预览图片区域和选择图片按钮的区域高度(默认 80 )
|
|
133
133
|
* */
|
|
134
|
-
height?: string | number
|
|
134
|
+
height?: string | number
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* 读取前的处理函数
|
|
137
137
|
* */
|
|
138
|
-
beforeRead?: (file: FileVo, detail: { name: string; index: number }) => void
|
|
138
|
+
beforeRead?: (file: FileVo, detail: { name: string; index: number }) => void
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* 读取后的处理函数
|
|
141
141
|
* */
|
|
142
|
-
afterRead?: (file: FileVo, detail: { name: string; index: number }) => void
|
|
142
|
+
afterRead?: (file: FileVo, detail: { name: string; index: number }) => void
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
144
|
+
* 定义需要用到的外部样式
|
|
145
145
|
* */
|
|
146
|
-
customStyle?: CSSProperties
|
|
146
|
+
customStyle?: CSSProperties
|
|
147
147
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<HyTransition mode="fade" :show="show">
|
|
3
3
|
<view
|
|
4
|
-
class="hy-warn"
|
|
5
|
-
:class="[`hy-warn--${type}--${theme}`]"
|
|
4
|
+
:class="['hy-warn', `hy-warn--${type}--${theme}`, customClass]"
|
|
6
5
|
@tap.stop="clickHandler"
|
|
7
|
-
:style="
|
|
6
|
+
:style="customStyle"
|
|
8
7
|
>
|
|
9
8
|
<view class="hy-warn__icon--left" v-if="showIcon">
|
|
10
9
|
<HyIcon :name="iconName(type)" size="21" :color="iconColor"></HyIcon>
|
|
@@ -26,13 +25,10 @@
|
|
|
26
25
|
textAlign: center ? 'center' : 'left',
|
|
27
26
|
},
|
|
28
27
|
]"
|
|
29
|
-
:class="[
|
|
30
|
-
theme === 'dark'
|
|
31
|
-
? 'hy-warn__text--dark'
|
|
32
|
-
: `hy-warn__text--${type}--light`,
|
|
33
|
-
]"
|
|
34
|
-
>{{ title }}</text
|
|
28
|
+
:class="[theme === 'dark' ? 'hy-warn__text--dark' : `hy-warn__text--${type}--light`]"
|
|
35
29
|
>
|
|
30
|
+
{{ title }}
|
|
31
|
+
</text>
|
|
36
32
|
<text
|
|
37
33
|
class="hy-warn__content__desc"
|
|
38
34
|
v-if="description"
|
|
@@ -42,13 +38,10 @@
|
|
|
42
38
|
textAlign: center ? 'center' : 'left',
|
|
43
39
|
},
|
|
44
40
|
]"
|
|
45
|
-
:class="[
|
|
46
|
-
theme === 'dark'
|
|
47
|
-
? 'hy-warn__text--dark'
|
|
48
|
-
: `hy-warn__text--${type}--light`,
|
|
49
|
-
]"
|
|
50
|
-
>{{ description }}</text
|
|
41
|
+
:class="[theme === 'dark' ? 'hy-warn__text--dark' : `hy-warn__text--${type}--light`]"
|
|
51
42
|
>
|
|
43
|
+
{{ description }}
|
|
44
|
+
</text>
|
|
52
45
|
</view>
|
|
53
46
|
<view class="hy-warn__close" v-if="closable" @tap.stop="closeHandler">
|
|
54
47
|
<HyIcon :name="IconConfig.CLOSE" :color="iconColor" size="15"></HyIcon>
|
|
@@ -58,55 +51,105 @@
|
|
|
58
51
|
</template>
|
|
59
52
|
|
|
60
53
|
<script lang="ts">
|
|
54
|
+
/**
|
|
55
|
+
* 警告提示,展现需要关注的信息
|
|
56
|
+
* @displayName hy-warn
|
|
57
|
+
*/
|
|
58
|
+
defineOptions({})
|
|
61
59
|
export default {
|
|
62
60
|
name: 'hy-warn',
|
|
63
61
|
options: {
|
|
64
62
|
addGlobalClass: true,
|
|
65
63
|
virtualHost: true,
|
|
66
|
-
styleIsolation: 'shared'
|
|
67
|
-
}
|
|
64
|
+
styleIsolation: 'shared',
|
|
65
|
+
},
|
|
68
66
|
}
|
|
69
67
|
</script>
|
|
70
68
|
|
|
71
69
|
<script setup lang="ts">
|
|
72
|
-
import { computed, ref, toRefs } from
|
|
73
|
-
import
|
|
74
|
-
import type
|
|
75
|
-
import { addUnit } from
|
|
76
|
-
import { IconConfig, iconName } from
|
|
70
|
+
import { computed, ref, toRefs } from 'vue'
|
|
71
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
72
|
+
import type { IWarnEmits } from './typing'
|
|
73
|
+
import { addUnit } from '../../utils'
|
|
74
|
+
import { IconConfig, iconName } from '../../config'
|
|
77
75
|
|
|
78
76
|
// 组件
|
|
79
|
-
import HyTransition from
|
|
80
|
-
import HyIcon from
|
|
77
|
+
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
78
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
81
79
|
|
|
82
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
83
|
-
const
|
|
84
|
-
|
|
80
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
81
|
+
const props = defineProps({
|
|
82
|
+
/** 显示的文字 */
|
|
83
|
+
title: String,
|
|
84
|
+
/**
|
|
85
|
+
* 使用预设的颜色
|
|
86
|
+
* @values primary,success,warning,error,info
|
|
87
|
+
* */
|
|
88
|
+
type: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'warning',
|
|
91
|
+
},
|
|
92
|
+
/** 辅助性文字,颜色比title浅一点,字号也小一点 */
|
|
93
|
+
description: String,
|
|
94
|
+
/** 显示关闭按钮 */
|
|
95
|
+
closable: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false,
|
|
98
|
+
},
|
|
99
|
+
/** 是否显示左边的辅助图标 */
|
|
100
|
+
showIcon: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: false,
|
|
103
|
+
},
|
|
104
|
+
/** 显示的暗色或者亮色 */
|
|
105
|
+
theme: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: 'light',
|
|
108
|
+
},
|
|
109
|
+
/** 文字是否居中 */
|
|
110
|
+
center: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false,
|
|
113
|
+
},
|
|
114
|
+
/** 字体大小 */
|
|
115
|
+
fontSize: {
|
|
116
|
+
type: [String, Number],
|
|
117
|
+
default: 14,
|
|
118
|
+
},
|
|
119
|
+
/** 定义需要用到的外部样式 */
|
|
120
|
+
customStyle: {
|
|
121
|
+
type: Object as PropType<CSSProperties>,
|
|
122
|
+
},
|
|
123
|
+
/** 自定义外部类名 */
|
|
124
|
+
customClass: String,
|
|
125
|
+
})
|
|
126
|
+
const { type, theme } = toRefs(props)
|
|
127
|
+
const emit = defineEmits<IWarnEmits>()
|
|
85
128
|
|
|
86
|
-
const show = ref<boolean>(true)
|
|
129
|
+
const show = ref<boolean>(true)
|
|
87
130
|
|
|
88
131
|
/**
|
|
89
132
|
* @description icon颜色
|
|
90
133
|
* */
|
|
91
134
|
const iconColor = computed(() => {
|
|
92
|
-
return theme.value ===
|
|
93
|
-
})
|
|
135
|
+
return theme.value === 'light' ? type.value : '#fff'
|
|
136
|
+
})
|
|
94
137
|
|
|
95
138
|
/**
|
|
96
139
|
* @description 点击内容
|
|
97
140
|
* */
|
|
98
141
|
const clickHandler = () => {
|
|
99
|
-
emit(
|
|
100
|
-
}
|
|
142
|
+
emit('click')
|
|
143
|
+
}
|
|
101
144
|
/**
|
|
102
145
|
* @description 点击关闭按钮
|
|
103
146
|
* */
|
|
104
147
|
const closeHandler = () => {
|
|
105
|
-
show.value = false
|
|
106
|
-
emit(
|
|
107
|
-
}
|
|
148
|
+
show.value = false
|
|
149
|
+
emit('close')
|
|
150
|
+
}
|
|
108
151
|
</script>
|
|
109
152
|
|
|
110
153
|
<style lang="scss" scoped>
|
|
111
|
-
@import
|
|
154
|
+
@import './index.scss';
|
|
112
155
|
</style>
|
|
@@ -1,41 +1,48 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
2
|
-
import { HyApp, type ThemeVo } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
import { HyApp, type ThemeVo } from '@/package/typing/modules/common'
|
|
3
3
|
|
|
4
4
|
export default interface HyWarnProps {
|
|
5
5
|
/**
|
|
6
6
|
* @description 显示的文字
|
|
7
7
|
* */
|
|
8
|
-
title: string
|
|
8
|
+
title: string
|
|
9
9
|
/**
|
|
10
10
|
* @description 使用预设的颜色 (默认 'warning' )
|
|
11
11
|
* */
|
|
12
|
-
type?: HyApp.ThemeType
|
|
12
|
+
type?: HyApp.ThemeType
|
|
13
13
|
/**
|
|
14
14
|
* @description 辅助性文字,颜色比title浅一点,字号也小一点,可选
|
|
15
15
|
* */
|
|
16
|
-
description?: string
|
|
16
|
+
description?: string
|
|
17
17
|
/**
|
|
18
18
|
* @description 关闭按钮(默认为叉号icon图标) (默认 false )
|
|
19
19
|
* */
|
|
20
|
-
closable?: boolean
|
|
20
|
+
closable?: boolean
|
|
21
21
|
/**
|
|
22
22
|
* @description 是否显示左边的辅助图标 ( 默认 false )
|
|
23
23
|
* */
|
|
24
|
-
showIcon?: boolean
|
|
24
|
+
showIcon?: boolean
|
|
25
25
|
/**
|
|
26
26
|
* @description 显示的暗色或者亮色 (默认 'light' )
|
|
27
27
|
* */
|
|
28
|
-
theme?: HyApp.ThemeVo
|
|
28
|
+
theme?: HyApp.ThemeVo
|
|
29
29
|
/**
|
|
30
30
|
* @description 文字是否居中 (默认 false )
|
|
31
31
|
* */
|
|
32
|
-
center?: boolean
|
|
32
|
+
center?: boolean
|
|
33
33
|
/**
|
|
34
34
|
* @description 字体大小 (默认 14 )
|
|
35
35
|
* */
|
|
36
|
-
fontSize?: number
|
|
36
|
+
fontSize?: number
|
|
37
37
|
/**
|
|
38
38
|
* @description 定义需要用到的外部样式
|
|
39
39
|
* */
|
|
40
|
-
customStyle?: CSSProperties
|
|
40
|
+
customStyle?: CSSProperties
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface IWarnEmits {
|
|
44
|
+
/** 点击触发 */
|
|
45
|
+
(e: 'click'): void
|
|
46
|
+
/** 关闭触发 */
|
|
47
|
+
(e: 'close'): void
|
|
41
48
|
}
|