hy-app 0.4.13 → 0.5.0
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 +155 -238
- package/components/hy-action-sheet/props.ts +68 -15
- package/components/hy-action-sheet/typing.d.ts +115 -115
- package/components/hy-address-picker/hy-address-picker.vue +185 -289
- package/components/hy-address-picker/props.ts +97 -21
- package/components/hy-address-picker/typing.d.ts +90 -89
- package/components/hy-avatar/hy-avatar.vue +121 -204
- package/components/hy-avatar/props.ts +76 -18
- package/components/hy-avatar/typing.d.ts +63 -62
- package/components/hy-back-top/hy-back-top.vue +65 -120
- package/components/hy-back-top/props.ts +57 -16
- package/components/hy-back-top/typing.d.ts +43 -42
- package/components/hy-badge/hy-badge.vue +66 -138
- package/components/hy-badge/props.ts +73 -17
- package/components/hy-badge/typing.d.ts +59 -58
- package/components/hy-button/hy-button.vue +226 -375
- package/components/hy-button/props.ts +129 -158
- package/components/hy-calendar/header.vue +48 -64
- package/components/hy-calendar/hy-calendar.vue +274 -438
- package/components/hy-calendar/month.vue +508 -516
- package/components/hy-calendar/props.ts +157 -35
- package/components/hy-calendar/typing.d.ts +129 -128
- package/components/hy-card/hy-card.vue +118 -240
- package/components/hy-card/index.scss +1 -2
- package/components/hy-card/props.ts +122 -27
- package/components/hy-card/typing.d.ts +119 -118
- package/components/hy-cell/hy-cell.vue +176 -258
- package/components/hy-cell/props.ts +71 -17
- package/components/hy-cell/typing.d.ts +87 -86
- package/components/hy-check-button/hy-check-button.vue +69 -139
- package/components/hy-check-button/props.ts +72 -18
- package/components/hy-check-button/typing.d.ts +74 -73
- package/components/hy-checkbox/hy-checkbox.vue +170 -263
- package/components/hy-checkbox/props.ts +94 -24
- package/components/hy-checkbox/typing.d.ts +72 -72
- package/components/hy-checkbox-group/hy-checkbox-group.vue +25 -100
- package/components/hy-checkbox-group/props.ts +80 -0
- package/components/hy-checkbox-group/typing.d.ts +65 -65
- package/components/hy-checkbox-item/hy-checkbox-item.vue +140 -177
- package/components/hy-checkbox-item/props.ts +24 -0
- package/components/hy-checkbox-item/typing.d.ts +4 -3
- package/components/hy-code-input/hy-code-input.vue +179 -262
- package/components/hy-code-input/props.ts +84 -18
- package/components/hy-code-input/typing.d.ts +71 -71
- package/components/hy-config-provider/hy-config-provider.vue +28 -50
- package/components/hy-config-provider/props.ts +26 -11
- package/components/hy-config-provider/typing.d.ts +20 -20
- package/components/hy-count-down/hy-count-down.vue +103 -131
- package/components/hy-count-down/props.ts +30 -8
- package/components/hy-count-down/typing.d.ts +25 -25
- package/components/hy-count-to/hy-count-to.vue +148 -213
- package/components/hy-count-to/props.ts +60 -15
- package/components/hy-count-to/typing.d.ts +46 -46
- package/components/hy-coupon/README.md +133 -0
- package/components/hy-coupon/hy-coupon.vue +180 -0
- package/components/hy-coupon/index.scss +553 -0
- package/components/hy-coupon/props.ts +129 -0
- package/components/hy-coupon/typing.d.ts +146 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +415 -580
- package/components/hy-datetime-picker/props.ts +142 -32
- package/components/hy-datetime-picker/typing.d.ts +132 -132
- package/components/hy-divider/hy-divider.vue +90 -169
- package/components/hy-divider/props.ts +78 -19
- package/components/hy-divider/typing.d.ts +60 -60
- package/components/hy-dropdown/hy-dropdown.vue +37 -71
- package/components/hy-dropdown/props.ts +38 -15
- package/components/hy-dropdown/typing.d.ts +44 -44
- package/components/hy-dropdown-item/hy-dropdown-item.vue +141 -173
- package/components/hy-dropdown-item/props.ts +19 -8
- package/components/hy-empty/hy-empty.vue +75 -129
- package/components/hy-empty/props.ts +57 -15
- package/components/hy-empty/typing.d.ts +84 -84
- package/components/hy-flex/hy-flex.vue +33 -88
- package/components/hy-flex/props.ts +58 -0
- package/components/hy-flex/typing.d.ts +14 -16
- package/components/hy-float-button/hy-float-button.vue +289 -406
- package/components/hy-float-button/props.ts +109 -25
- package/components/hy-folding-panel/hy-folding-panel.vue +86 -374
- package/components/hy-folding-panel/props.ts +40 -15
- package/components/hy-folding-panel/typing.d.ts +52 -63
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +186 -228
- package/components/hy-folding-panel-item/index.scss +87 -0
- package/components/hy-folding-panel-item/props.ts +81 -0
- package/components/hy-folding-panel-item/typing.d.ts +23 -0
- package/components/hy-form/hy-form.vue +172 -212
- package/components/hy-form/props.ts +37 -0
- package/components/hy-form/typing.d.ts +68 -61
- package/components/hy-form-group/typing.d.ts +74 -74
- package/components/hy-form-item/hy-form-item.vue +100 -129
- package/components/hy-form-item/props.ts +25 -0
- package/components/hy-form-item/typing.d.ts +40 -37
- package/components/hy-grid/hy-grid.vue +76 -132
- package/components/hy-grid/props.ts +58 -16
- package/components/hy-grid/typing.d.ts +66 -66
- package/components/hy-icon/hy-icon.vue +84 -161
- package/components/hy-icon/props.ts +76 -22
- package/components/hy-icon/typing.d.ts +83 -82
- package/components/hy-image/hy-image.vue +142 -272
- package/components/hy-image/props.ts +105 -23
- package/components/hy-image/typing.d.ts +84 -87
- package/components/hy-input/hy-input.vue +230 -421
- package/components/hy-input/props.ts +183 -35
- package/components/hy-input/typing.d.ts +169 -169
- package/components/hy-line/hy-line.vue +34 -72
- package/components/hy-line/props.ts +41 -10
- package/components/hy-line/typing.d.ts +29 -29
- package/components/hy-line-progress/hy-line-progress.vue +66 -101
- package/components/hy-line-progress/props.ts +31 -10
- package/components/hy-line-progress/typing.d.ts +29 -29
- package/components/hy-list/hy-list.vue +151 -220
- package/components/hy-list/props.ts +67 -16
- package/components/hy-list/typing.d.ts +52 -52
- package/components/hy-loading/hy-loading.vue +63 -119
- package/components/hy-loading/props.ts +63 -15
- package/components/hy-loading/typing.d.ts +49 -49
- package/components/hy-menu/hy-menu.vue +124 -166
- package/components/hy-menu/props.ts +42 -10
- package/components/hy-menu/typing.d.ts +60 -60
- package/components/hy-modal/hy-modal.vue +127 -218
- package/components/hy-modal/props.ts +89 -24
- package/components/hy-navbar/hy-navbar.vue +104 -177
- package/components/hy-navbar/props.ts +76 -22
- package/components/hy-navbar/typing.d.ts +81 -81
- package/components/hy-notice-bar/hy-notice-bar.vue +67 -144
- package/components/hy-notice-bar/props.ts +80 -19
- package/components/hy-notice-bar/typing.d.ts +62 -62
- package/components/hy-notify/hy-notify.vue +128 -177
- package/components/hy-notify/props.ts +49 -12
- package/components/hy-notify/typing.d.ts +45 -41
- package/components/hy-number-step/hy-number-step.vue +281 -394
- package/components/hy-number-step/props.ts +110 -27
- package/components/hy-number-step/typing.d.ts +120 -120
- package/components/hy-overlay/hy-overlay.vue +39 -66
- package/components/hy-overlay/props.ts +31 -8
- package/components/hy-pagination/hy-pagination.vue +100 -155
- package/components/hy-pagination/props.ts +53 -13
- package/components/hy-picker/hy-picker.vue +309 -430
- package/components/hy-picker/index.scss +8 -12
- package/components/hy-picker/props.ts +110 -26
- package/components/hy-popover/hy-popover.vue +190 -252
- package/components/hy-popover/props.ts +48 -10
- package/components/hy-popup/hy-popup.vue +162 -248
- package/components/hy-popup/props.ts +82 -18
- package/components/hy-price/hy-price.vue +45 -104
- package/components/hy-price/props.ts +52 -12
- package/components/hy-price/typing.d.ts +41 -36
- package/components/hy-qrcode/hy-qrcode.vue +115 -185
- package/components/hy-qrcode/props.ts +68 -18
- package/components/hy-qrcode/typing.d.ts +67 -66
- package/components/hy-radio/hy-radio.vue +161 -259
- package/components/hy-radio/props.ts +95 -25
- package/components/hy-radio/typing.d.ts +85 -84
- package/components/hy-rate/hy-rate.vue +185 -270
- package/components/hy-rate/props.ts +76 -18
- package/components/hy-rate/typing.d.ts +61 -60
- package/components/hy-read-more/hy-read-more.vue +93 -136
- package/components/hy-read-more/props.ts +43 -13
- package/components/hy-scroll-list/hy-scroll-list.vue +81 -102
- package/components/hy-scroll-list/props.ts +22 -11
- package/components/hy-search/hy-search.vue +155 -284
- package/components/hy-search/props.ts +130 -25
- package/components/hy-signature/hy-signature.vue +491 -635
- package/components/hy-signature/props.ts +115 -26
- package/components/hy-signature/typing.d.ts +138 -138
- package/components/hy-slider/hy-slider.vue +388 -477
- package/components/hy-slider/props.ts +75 -19
- package/components/hy-steps/hy-steps.vue +212 -279
- package/components/hy-steps/props.ts +47 -13
- package/components/hy-submit-bar/hy-submit-bar.vue +137 -222
- package/components/hy-submit-bar/props.ts +89 -20
- package/components/hy-submit-bar/typing.d.ts +86 -85
- package/components/hy-subsection/hy-subsection.vue +132 -185
- package/components/hy-subsection/props.ts +50 -17
- package/components/hy-subsection/typing.d.ts +52 -52
- package/components/hy-swipe-action/hy-swipe-action.vue +228 -283
- package/components/hy-swipe-action/props.ts +43 -18
- package/components/hy-swipe-action/typing.d.ts +46 -46
- package/components/hy-swiper/hy-swiper.vue +159 -286
- package/components/hy-swiper/props.ts +126 -28
- package/components/hy-swiper/typing.d.ts +115 -115
- package/components/hy-switch/hy-switch.vue +112 -176
- package/components/hy-switch/props.ts +60 -15
- package/components/hy-switch/typing.d.ts +63 -63
- package/components/hy-tabBar/hy-tabBar.vue +64 -60
- package/components/hy-tabs/hy-tabs.vue +277 -380
- package/components/hy-tabs/props.ts +75 -18
- package/components/hy-tag/hy-tag.vue +111 -204
- package/components/hy-tag/props.ts +81 -19
- package/components/hy-text/hy-text.vue +200 -322
- package/components/hy-text/props.ts +107 -28
- package/components/hy-textarea/hy-textarea.vue +147 -256
- package/components/hy-textarea/props.ts +112 -25
- package/components/hy-textarea/typing.d.ts +42 -42
- package/components/hy-toast/hy-toast.vue +135 -143
- package/components/hy-tooltip/hy-tooltip.vue +220 -306
- package/components/hy-tooltip/props.ts +79 -15
- package/components/hy-transition/hy-transition.vue +111 -138
- package/components/hy-transition/props.ts +30 -8
- package/components/hy-upload/hy-upload.vue +320 -469
- package/components/hy-upload/props.ts +130 -27
- package/components/hy-warn/hy-warn.vue +80 -129
- package/components/hy-warn/props.ts +47 -12
- package/components/hy-waterfall/hy-waterfall.vue +139 -163
- package/components/hy-waterfall/props.ts +19 -7
- package/components/hy-watermark/hy-watermark.vue +762 -870
- package/components/hy-watermark/props.ts +103 -22
- package/global.d.ts +2 -0
- package/libs/css/theme.scss +3 -3
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-folding-panel/index.scss +0 -9
|
@@ -1,20 +1,77 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { TabsItemVo } from './typing'
|
|
2
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
3
|
+
import type HyBadgeProps from '../hy-badge/typing'
|
|
2
4
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
5
|
+
const tabsProps = {
|
|
6
|
+
/** 标签数组,元素为对象,如[{name: '推荐'}] */
|
|
7
|
+
list: {
|
|
8
|
+
type: Array as unknown as PropType<TabsItemVo[]>,
|
|
9
|
+
default: []
|
|
10
|
+
},
|
|
11
|
+
/** 当前选中标签的索引 */
|
|
12
|
+
current: {
|
|
13
|
+
type: Number,
|
|
14
|
+
default: 0
|
|
15
|
+
},
|
|
16
|
+
/** 从list元素对象中读取的键名 */
|
|
17
|
+
keyName: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'name'
|
|
20
|
+
},
|
|
21
|
+
/** 滑块移动一次所需的时间,单位秒 */
|
|
22
|
+
duration: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 300
|
|
25
|
+
},
|
|
26
|
+
/** 滑块颜色 */
|
|
27
|
+
lineColor: String,
|
|
28
|
+
/** 菜单选择中时的样式 */
|
|
29
|
+
activeStyle: {
|
|
30
|
+
type: Object as PropType<CSSProperties>,
|
|
31
|
+
default: {}
|
|
32
|
+
},
|
|
33
|
+
/** 菜单非选中时的样式 */
|
|
34
|
+
inactiveStyle: {
|
|
35
|
+
type: Object as PropType<CSSProperties>,
|
|
36
|
+
default: {}
|
|
37
|
+
},
|
|
38
|
+
/** 滑块长度 */
|
|
39
|
+
lineWidth: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: 20
|
|
42
|
+
},
|
|
43
|
+
/** 滑块高度 */
|
|
44
|
+
lineHeight: {
|
|
45
|
+
type: [String, Number],
|
|
46
|
+
default: 3
|
|
47
|
+
},
|
|
48
|
+
/** 滑块背景显示大小,当滑块背景设置为图片时使用 */
|
|
49
|
+
lineBgSize: {
|
|
50
|
+
type: [String, Number],
|
|
51
|
+
default: 'cover'
|
|
52
|
+
},
|
|
53
|
+
/** 菜单item的样式 */
|
|
54
|
+
itemStyle: Object as PropType<CSSProperties>,
|
|
55
|
+
/** 轮播图高度 */
|
|
56
|
+
swiperHeight: {
|
|
57
|
+
type: [String, Number],
|
|
58
|
+
default: 'calc(100vh - 44px)'
|
|
59
|
+
},
|
|
60
|
+
/** 菜单是否可滚动 */
|
|
61
|
+
scrollable: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: true
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* @description 徽标props全局定义
|
|
67
|
+
* */
|
|
68
|
+
propsBadge: Object as PropType<HyBadgeProps>,
|
|
69
|
+
/** 标签左侧图标样式自定义 */
|
|
70
|
+
iconStyle: Object as PropType<CSSProperties>,
|
|
71
|
+
/** 定义需要用到的外部样式 */
|
|
72
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
73
|
+
/** 自定义外部类名 */
|
|
74
|
+
customClass: String
|
|
75
|
+
}
|
|
19
76
|
|
|
20
|
-
export default
|
|
77
|
+
export default tabsProps
|
|
@@ -1,267 +1,174 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
:size="closeSize"
|
|
39
|
-
color="#ffffff"
|
|
40
|
-
></HyIcon>
|
|
41
|
-
</view>
|
|
42
|
-
</view>
|
|
43
|
-
</HyTransition>
|
|
2
|
+
<hy-transition mode="fade" :show="show" :custom-style="{ display: 'inline-block' }">
|
|
3
|
+
<view class="hy-tag__wrapper cursor-pointer">
|
|
4
|
+
<view :class="tagClass" @tap.stop="clickHandler" :style="tagStyle">
|
|
5
|
+
<slot name="icon">
|
|
6
|
+
<hy-icon
|
|
7
|
+
v-if="icon?.name"
|
|
8
|
+
:name="icon?.name"
|
|
9
|
+
:color="hyIconColor"
|
|
10
|
+
:size="hyIconSize"
|
|
11
|
+
:bold="icon?.bold"
|
|
12
|
+
:customPrefix="icon?.customPrefix"
|
|
13
|
+
:imgMode="icon?.imgMode"
|
|
14
|
+
:width="icon?.width"
|
|
15
|
+
:height="icon?.height"
|
|
16
|
+
:top="icon?.top"
|
|
17
|
+
:stop="icon?.stop"
|
|
18
|
+
:round="icon?.round"
|
|
19
|
+
:customStyle="Object.assign({ marginRight: '3px' }, icon?.customStyle)"
|
|
20
|
+
></hy-icon>
|
|
21
|
+
</slot>
|
|
22
|
+
<text :class="textClass" :style="textStyle">
|
|
23
|
+
<slot>
|
|
24
|
+
{{ text }}
|
|
25
|
+
</slot>
|
|
26
|
+
</text>
|
|
27
|
+
</view>
|
|
28
|
+
<view
|
|
29
|
+
:class="['hy-tag__close', `hy-tag__close--${size}`]"
|
|
30
|
+
v-if="closable"
|
|
31
|
+
@tap.stop="closeHandler"
|
|
32
|
+
:style="{ backgroundColor: closeColor }"
|
|
33
|
+
>
|
|
34
|
+
<hy-icon :name="IconConfig.CLOSE" :size="closeSize" color="#ffffff"></hy-icon>
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
</hy-transition>
|
|
44
38
|
</template>
|
|
45
39
|
|
|
46
40
|
<script lang="ts">
|
|
47
41
|
export default {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
42
|
+
name: 'hy-tag',
|
|
43
|
+
options: {
|
|
44
|
+
addGlobalClass: true,
|
|
45
|
+
virtualHost: true,
|
|
46
|
+
styleIsolation: 'shared'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
55
49
|
</script>
|
|
56
50
|
|
|
57
51
|
<script setup lang="ts">
|
|
58
|
-
import { computed } from
|
|
59
|
-
import type { CSSProperties
|
|
60
|
-
import type { ITagEmits } from
|
|
61
|
-
import { IconConfig, colorGradient } from
|
|
62
|
-
import
|
|
52
|
+
import { computed } from 'vue'
|
|
53
|
+
import type { CSSProperties } from 'vue'
|
|
54
|
+
import type { ITagEmits } from './typing'
|
|
55
|
+
import { IconConfig, colorGradient } from '../../libs'
|
|
56
|
+
import tagProps from './props'
|
|
63
57
|
|
|
64
58
|
// 组件
|
|
65
|
-
import HyTransition from
|
|
66
|
-
import HyIcon from
|
|
59
|
+
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
60
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
67
61
|
|
|
68
62
|
/**
|
|
69
63
|
* tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
|
|
70
64
|
* @displayName hy-tag
|
|
71
65
|
*/
|
|
72
|
-
defineOptions({})
|
|
66
|
+
defineOptions({})
|
|
73
67
|
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
/** 标签的文字内容 */
|
|
77
|
-
text: String,
|
|
78
|
-
/** 点击需要传得值 */
|
|
79
|
-
name: [String, Number],
|
|
80
|
-
/**
|
|
81
|
-
* 标签类型
|
|
82
|
-
* @values info,primary,success,error,warning
|
|
83
|
-
* */
|
|
84
|
-
type: {
|
|
85
|
-
type: String,
|
|
86
|
-
default: "primary",
|
|
87
|
-
},
|
|
88
|
-
/** 禁用点击标签 */
|
|
89
|
-
disabled: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
default: false,
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* 标签的大小
|
|
95
|
-
* @values large,medium,small,mini
|
|
96
|
-
* */
|
|
97
|
-
size: {
|
|
98
|
-
type: String,
|
|
99
|
-
default: "medium",
|
|
100
|
-
},
|
|
101
|
-
/**
|
|
102
|
-
* tag的形状
|
|
103
|
-
* @values circle,square,opposite
|
|
104
|
-
* */
|
|
105
|
-
shape: {
|
|
106
|
-
type: String,
|
|
107
|
-
default: "square",
|
|
108
|
-
},
|
|
109
|
-
/** 背景颜色,默认为空字符串,即不处理 */
|
|
110
|
-
bgColor: String,
|
|
111
|
-
/** 标签字体颜色,默认为空字符串,即不处理 */
|
|
112
|
-
color: String,
|
|
113
|
-
/** 镂空形式标签的边框颜色 */
|
|
114
|
-
borderColor: String,
|
|
115
|
-
/** 关闭按钮图标的颜色 */
|
|
116
|
-
closeColor: {
|
|
117
|
-
type: String,
|
|
118
|
-
default: "#C6C7CB",
|
|
119
|
-
},
|
|
120
|
-
/** 镂空时是否填充背景色 */
|
|
121
|
-
plainFill: {
|
|
122
|
-
type: Boolean,
|
|
123
|
-
default: false,
|
|
124
|
-
},
|
|
125
|
-
/** 是否镂空 */
|
|
126
|
-
plain: {
|
|
127
|
-
type: Boolean,
|
|
128
|
-
default: false,
|
|
129
|
-
},
|
|
130
|
-
/** 是否可关闭,设置为true,文字右边会出现一个关闭图标 */
|
|
131
|
-
closable: {
|
|
132
|
-
type: Boolean,
|
|
133
|
-
default: false,
|
|
134
|
-
},
|
|
135
|
-
/** 标签显示与否 */
|
|
136
|
-
show: {
|
|
137
|
-
type: Boolean,
|
|
138
|
-
default: true,
|
|
139
|
-
},
|
|
140
|
-
/** 组件内置图标,或绝对路径的图片 */
|
|
141
|
-
icon: Object as PropType<HyIconProps>,
|
|
142
|
-
/** 定义需要用到的外部样式 */
|
|
143
|
-
customStyle: {
|
|
144
|
-
type: Object as PropType<CSSProperties>,
|
|
145
|
-
default: () => {},
|
|
146
|
-
},
|
|
147
|
-
/** 自定义外部类名 */
|
|
148
|
-
customClass: {
|
|
149
|
-
type: String,
|
|
150
|
-
default: "",
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
const emit = defineEmits<ITagEmits>();
|
|
68
|
+
const props = defineProps(tagProps)
|
|
69
|
+
const emit = defineEmits<ITagEmits>()
|
|
154
70
|
|
|
155
71
|
/**
|
|
156
72
|
* @description tag类名
|
|
157
73
|
* */
|
|
158
74
|
const tagClass = computed((): string[] => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
].filter(Boolean);
|
|
172
|
-
classes = classes.concat(arr as string[]);
|
|
173
|
-
}
|
|
174
|
-
return classes;
|
|
175
|
-
});
|
|
75
|
+
let classes = ['hy-tag', `hy-tag--${props.shape}`, `hy-tag--${props.size}`, props.customClass]
|
|
76
|
+
if (props.disabled) {
|
|
77
|
+
classes.push('hy-tag--disabled')
|
|
78
|
+
} else {
|
|
79
|
+
const arr = [
|
|
80
|
+
props.plain ? `hy-tag--${props.type}--plain` : `hy-tag--${props.type}`,
|
|
81
|
+
props.plain && props.plainFill && `hy-tag--${props.type}--plain__fill`
|
|
82
|
+
].filter(Boolean)
|
|
83
|
+
classes = classes.concat(arr as string[])
|
|
84
|
+
}
|
|
85
|
+
return classes
|
|
86
|
+
})
|
|
176
87
|
/**
|
|
177
88
|
* @description tag样式
|
|
178
89
|
* */
|
|
179
90
|
const tagStyle = computed<CSSProperties>(() => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
91
|
+
const style: CSSProperties = {
|
|
92
|
+
marginRight: props.closable ? '10px' : 0,
|
|
93
|
+
marginTop: props.closable ? '10px' : 0,
|
|
94
|
+
background: props.bgColor,
|
|
95
|
+
borderColor: props.borderColor
|
|
96
|
+
}
|
|
186
97
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
98
|
+
if (props.color) {
|
|
99
|
+
if (props.plain) {
|
|
100
|
+
style.borderColor = props.color
|
|
101
|
+
if (props.plainFill) {
|
|
102
|
+
style.background = colorGradient(props.color, '#FFFFFF', 100)[90]
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
style.background = props.color
|
|
106
|
+
style.borderColor = props.color
|
|
107
|
+
}
|
|
196
108
|
}
|
|
197
|
-
}
|
|
198
109
|
|
|
199
|
-
|
|
200
|
-
})
|
|
110
|
+
return Object.assign(style, props.customStyle)
|
|
111
|
+
})
|
|
201
112
|
|
|
202
113
|
/**
|
|
203
114
|
* @description 文本样式
|
|
204
115
|
* */
|
|
205
116
|
const textStyle = computed(() => {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
})
|
|
117
|
+
const style: CSSProperties = {}
|
|
118
|
+
if (props.color && props.plain) style.color = props.color
|
|
119
|
+
return style
|
|
120
|
+
})
|
|
210
121
|
/**
|
|
211
122
|
* @description 文本类名
|
|
212
123
|
* */
|
|
213
124
|
const textClass = computed((): string[] => {
|
|
214
|
-
|
|
215
|
-
})
|
|
125
|
+
return [`hy-tag__text`, `hy-tag__text--${props.size}`]
|
|
126
|
+
})
|
|
216
127
|
|
|
217
128
|
/**
|
|
218
129
|
* @description 关闭图标icon大小
|
|
219
130
|
*/
|
|
220
131
|
const closeSize = computed(() => {
|
|
221
|
-
|
|
222
|
-
})
|
|
132
|
+
return props.size === 'large' ? 15 : props.size === 'medium' ? 13 : 11
|
|
133
|
+
})
|
|
223
134
|
/**
|
|
224
135
|
* @description 图标大小
|
|
225
136
|
* */
|
|
226
137
|
const hyIconSize = computed(() => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
})
|
|
138
|
+
if (props.icon?.size) {
|
|
139
|
+
return props.icon.size
|
|
140
|
+
} else {
|
|
141
|
+
return props.size === 'large' ? 18 : props.size === 'medium' ? 14 : 10
|
|
142
|
+
}
|
|
143
|
+
})
|
|
233
144
|
/**
|
|
234
145
|
* @description 图标颜色
|
|
235
146
|
* */
|
|
236
147
|
const hyIconColor = computed(() => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
: props.plain
|
|
240
|
-
? props.type
|
|
241
|
-
: "#ffffff";
|
|
242
|
-
});
|
|
148
|
+
return props.icon?.color ? props.icon.color : props.plain ? props.type : '#ffffff'
|
|
149
|
+
})
|
|
243
150
|
|
|
244
151
|
/**
|
|
245
152
|
* @description 点击关闭按钮
|
|
246
153
|
* */
|
|
247
154
|
const closeHandler = () => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
155
|
+
if (!props.disabled) {
|
|
156
|
+
emit('close', props.text)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
252
159
|
/**
|
|
253
160
|
* @description 点击标签
|
|
254
161
|
* */
|
|
255
162
|
const clickHandler = () => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
163
|
+
if (!props.disabled) {
|
|
164
|
+
emit('click', {
|
|
165
|
+
value: props.text,
|
|
166
|
+
name: props.name
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
}
|
|
263
170
|
</script>
|
|
264
171
|
|
|
265
172
|
<style lang="scss" scoped>
|
|
266
|
-
@import
|
|
173
|
+
@import './index.scss';
|
|
267
174
|
</style>
|
|
@@ -1,21 +1,83 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
+
import type HyIconProps from './typing'
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
const tagProps = {
|
|
5
|
+
/** 标签的文字内容 */
|
|
6
|
+
text: String,
|
|
7
|
+
/** 点击需要传得值 */
|
|
8
|
+
name: [String, Number],
|
|
9
|
+
/**
|
|
10
|
+
* 标签类型
|
|
11
|
+
* @values info,primary,success,error,warning
|
|
12
|
+
* */
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'primary'
|
|
16
|
+
},
|
|
17
|
+
/** 禁用点击标签 */
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* 标签的大小
|
|
24
|
+
* @values large,medium,small,mini
|
|
25
|
+
* */
|
|
26
|
+
size: {
|
|
27
|
+
type: String as PropType<HyApp.SizeType | 'mini'>,
|
|
28
|
+
default: 'medium'
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* tag的形状
|
|
32
|
+
* @values circle,square,opposite
|
|
33
|
+
* */
|
|
34
|
+
shape: {
|
|
35
|
+
type: String as PropType<HyApp.ShapeType | 'opposite'>,
|
|
36
|
+
default: 'square'
|
|
37
|
+
},
|
|
38
|
+
/** 背景颜色,默认为空字符串,即不处理 */
|
|
39
|
+
bgColor: String,
|
|
40
|
+
/** 标签字体颜色,默认为空字符串,即不处理 */
|
|
41
|
+
color: String,
|
|
42
|
+
/** 镂空形式标签的边框颜色 */
|
|
43
|
+
borderColor: String,
|
|
44
|
+
/** 关闭按钮图标的颜色 */
|
|
45
|
+
closeColor: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '#C6C7CB'
|
|
48
|
+
},
|
|
49
|
+
/** 镂空时是否填充背景色 */
|
|
50
|
+
plainFill: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
/** 是否镂空 */
|
|
55
|
+
plain: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
/** 是否可关闭,设置为true,文字右边会出现一个关闭图标 */
|
|
60
|
+
closable: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false
|
|
63
|
+
},
|
|
64
|
+
/** 标签显示与否 */
|
|
65
|
+
show: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: true
|
|
68
|
+
},
|
|
69
|
+
/** 组件内置图标,或绝对路径的图片 */
|
|
70
|
+
icon: Object as PropType<HyIconProps>,
|
|
71
|
+
/** 定义需要用到的外部样式 */
|
|
72
|
+
customStyle: {
|
|
73
|
+
type: Object as PropType<CSSProperties>,
|
|
74
|
+
default: () => {}
|
|
75
|
+
},
|
|
76
|
+
/** 自定义外部类名 */
|
|
77
|
+
customClass: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ''
|
|
80
|
+
}
|
|
81
|
+
}
|
|
20
82
|
|
|
21
|
-
export default
|
|
83
|
+
export default tagProps
|