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
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
:top="icon?.top"
|
|
17
17
|
:stop="icon?.stop"
|
|
18
18
|
:round="icon?.round"
|
|
19
|
-
:customStyle="
|
|
20
|
-
Object.assign({ marginRight: '3px' }, icon?.customStyle)
|
|
21
|
-
"
|
|
19
|
+
:customStyle="Object.assign({ marginRight: '3px' }, icon?.customStyle)"
|
|
22
20
|
></HyIcon>
|
|
23
21
|
</slot>
|
|
24
22
|
<text :class="textClass" :style="textStyle">
|
|
@@ -33,37 +31,117 @@
|
|
|
33
31
|
@tap.stop="closeHandler"
|
|
34
32
|
:style="{ backgroundColor: closeColor }"
|
|
35
33
|
>
|
|
36
|
-
<HyIcon
|
|
37
|
-
:name="IconConfig.CLOSE"
|
|
38
|
-
:size="closeSize"
|
|
39
|
-
color="#ffffff"
|
|
40
|
-
></HyIcon>
|
|
34
|
+
<HyIcon :name="IconConfig.CLOSE" :size="closeSize" color="#ffffff"></HyIcon>
|
|
41
35
|
</view>
|
|
42
36
|
</view>
|
|
43
37
|
</HyTransition>
|
|
44
38
|
</template>
|
|
45
39
|
|
|
46
40
|
<script lang="ts">
|
|
41
|
+
/**
|
|
42
|
+
* tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
|
|
43
|
+
* @displayName hy-tag
|
|
44
|
+
*/
|
|
45
|
+
defineOptions({})
|
|
47
46
|
export default {
|
|
48
47
|
name: 'hy-tag',
|
|
49
48
|
options: {
|
|
50
49
|
addGlobalClass: true,
|
|
51
50
|
virtualHost: true,
|
|
52
|
-
styleIsolation: 'shared'
|
|
53
|
-
}
|
|
51
|
+
styleIsolation: 'shared',
|
|
52
|
+
},
|
|
54
53
|
}
|
|
55
54
|
</script>
|
|
56
55
|
|
|
57
56
|
<script setup lang="ts">
|
|
58
|
-
import { computed, type CSSProperties, toRefs } from
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
import
|
|
62
|
-
import
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
import { computed, type CSSProperties, PropType, toRefs } from 'vue'
|
|
58
|
+
import type { ITagEmits } from './typing'
|
|
59
|
+
import { IconConfig } from '../../config'
|
|
60
|
+
import { colorGradient } from '../../utils'
|
|
61
|
+
import HyIconProps from '../hy-icon/typing'
|
|
62
|
+
|
|
63
|
+
// 组件
|
|
64
|
+
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
65
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
65
66
|
|
|
66
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
67
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
68
|
+
const props = defineProps({
|
|
69
|
+
/** 标签的文字内容 */
|
|
70
|
+
text: String,
|
|
71
|
+
/** 点击需要传得值 */
|
|
72
|
+
name: String,
|
|
73
|
+
/**
|
|
74
|
+
* 标签类型
|
|
75
|
+
* @values info,primary,success,error,warning
|
|
76
|
+
* */
|
|
77
|
+
type: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'primary',
|
|
80
|
+
},
|
|
81
|
+
/** 禁用点击标签 */
|
|
82
|
+
disabled: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* 标签的大小
|
|
88
|
+
* @values large,medium,small
|
|
89
|
+
* */
|
|
90
|
+
size: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: 'medium',
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* tag的形状
|
|
96
|
+
* @values circle,square
|
|
97
|
+
* */
|
|
98
|
+
shape: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: 'square',
|
|
101
|
+
},
|
|
102
|
+
/** 背景颜色,默认为空字符串,即不处理 */
|
|
103
|
+
bgColor: String,
|
|
104
|
+
/** 标签字体颜色,默认为空字符串,即不处理 */
|
|
105
|
+
color: String,
|
|
106
|
+
/** 镂空形式标签的边框颜色 */
|
|
107
|
+
borderColor: String,
|
|
108
|
+
/** 关闭按钮图标的颜色 */
|
|
109
|
+
closeColor: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: '#C6C7CB',
|
|
112
|
+
},
|
|
113
|
+
/** 镂空时是否填充背景色 */
|
|
114
|
+
plainFill: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false,
|
|
117
|
+
},
|
|
118
|
+
/** 是否镂空 */
|
|
119
|
+
plain: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: false,
|
|
122
|
+
},
|
|
123
|
+
/** 是否可关闭,设置为true,文字右边会出现一个关闭图标 */
|
|
124
|
+
closable: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: false,
|
|
127
|
+
},
|
|
128
|
+
/** 标签显示与否 */
|
|
129
|
+
show: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: true,
|
|
132
|
+
},
|
|
133
|
+
/** 组件内置图标,或绝对路径的图片 */
|
|
134
|
+
icon: {
|
|
135
|
+
type: Object as PropType<HyIconProps>,
|
|
136
|
+
default: {},
|
|
137
|
+
},
|
|
138
|
+
/** 定义需要用到的外部样式 */
|
|
139
|
+
customStyle: {
|
|
140
|
+
type: Object as PropType<CSSProperties>,
|
|
141
|
+
},
|
|
142
|
+
/** 自定义外部类名 */
|
|
143
|
+
customClass: String,
|
|
144
|
+
})
|
|
67
145
|
const {
|
|
68
146
|
text,
|
|
69
147
|
name,
|
|
@@ -79,115 +157,112 @@ const {
|
|
|
79
157
|
icon,
|
|
80
158
|
disabled,
|
|
81
159
|
customStyle,
|
|
82
|
-
|
|
83
|
-
|
|
160
|
+
customClass,
|
|
161
|
+
} = toRefs(props)
|
|
162
|
+
const emit = defineEmits<ITagEmits>()
|
|
84
163
|
|
|
85
164
|
/**
|
|
86
165
|
* @description tag类名
|
|
87
166
|
* */
|
|
88
167
|
const tagClass = computed((): string[] => {
|
|
89
|
-
let classes = [
|
|
168
|
+
let classes = ['hy-tag', `hy-tag--${shape.value}`, `hy-tag--${size.value}`, customClass.value]
|
|
90
169
|
if (disabled.value) {
|
|
91
|
-
classes.push(
|
|
170
|
+
classes.push('hy-tag--disabled')
|
|
92
171
|
} else {
|
|
93
172
|
const arr = [
|
|
94
173
|
!plain.value && `hy-tag--${type.value}`,
|
|
95
174
|
plain.value && `hy-tag--${type.value}--plain`,
|
|
96
175
|
plain.value && plainFill.value && `hy-tag--${type.value}--plain__fill`,
|
|
97
|
-
].filter(Boolean)
|
|
98
|
-
classes = classes.concat(arr as string[])
|
|
176
|
+
].filter(Boolean)
|
|
177
|
+
classes = classes.concat(arr as string[])
|
|
99
178
|
}
|
|
100
|
-
return classes
|
|
101
|
-
})
|
|
179
|
+
return classes
|
|
180
|
+
})
|
|
102
181
|
/**
|
|
103
182
|
* @description tag样式
|
|
104
183
|
* */
|
|
105
184
|
const tagStyle = computed<CSSProperties>(() => {
|
|
106
185
|
const style: CSSProperties = {
|
|
107
|
-
marginRight: closable.value ?
|
|
108
|
-
marginTop: closable.value ?
|
|
186
|
+
marginRight: closable.value ? '10px' : 0,
|
|
187
|
+
marginTop: closable.value ? '10px' : 0,
|
|
109
188
|
background: bgColor.value,
|
|
110
189
|
borderColor: borderColor.value,
|
|
111
|
-
}
|
|
190
|
+
}
|
|
112
191
|
|
|
113
192
|
if (color.value) {
|
|
114
193
|
if (plain.value) {
|
|
115
|
-
style.borderColor = color.value
|
|
194
|
+
style.borderColor = color.value
|
|
116
195
|
if (plainFill.value) {
|
|
117
|
-
style.background = colorGradient(color.value,
|
|
196
|
+
style.background = colorGradient(color.value, '#FFFFFF', 100)[90]
|
|
118
197
|
}
|
|
119
198
|
} else {
|
|
120
|
-
style.background = color.value
|
|
121
|
-
style.borderColor = color.value
|
|
199
|
+
style.background = color.value
|
|
200
|
+
style.borderColor = color.value
|
|
122
201
|
}
|
|
123
202
|
}
|
|
124
203
|
|
|
125
|
-
return Object.assign(style, customStyle.value)
|
|
126
|
-
})
|
|
204
|
+
return Object.assign(style, customStyle.value)
|
|
205
|
+
})
|
|
127
206
|
|
|
128
207
|
/**
|
|
129
208
|
* @description 文本样式
|
|
130
209
|
* */
|
|
131
210
|
const textStyle = computed(() => {
|
|
132
|
-
const style: CSSProperties = {}
|
|
133
|
-
if (color.value && plain.value) style.color = color.value
|
|
134
|
-
return style
|
|
135
|
-
})
|
|
211
|
+
const style: CSSProperties = {}
|
|
212
|
+
if (color.value && plain.value) style.color = color.value
|
|
213
|
+
return style
|
|
214
|
+
})
|
|
136
215
|
/**
|
|
137
216
|
* @description 文本类名
|
|
138
217
|
* */
|
|
139
218
|
const textClass = computed((): string[] => {
|
|
140
|
-
return [`hy-tag__text`, `hy-tag__text--${size.value}`]
|
|
141
|
-
})
|
|
219
|
+
return [`hy-tag__text`, `hy-tag__text--${size.value}`]
|
|
220
|
+
})
|
|
142
221
|
|
|
143
222
|
/**
|
|
144
223
|
* @description 关闭图标icon大小
|
|
145
224
|
*/
|
|
146
225
|
const closeSize = computed(() => {
|
|
147
|
-
return size.value ===
|
|
148
|
-
})
|
|
226
|
+
return size.value === 'large' ? 15 : size.value === 'medium' ? 13 : 11
|
|
227
|
+
})
|
|
149
228
|
/**
|
|
150
229
|
* @description 图标大小
|
|
151
230
|
* */
|
|
152
231
|
const hyIconSize = computed(() => {
|
|
153
232
|
if (icon.value.size) {
|
|
154
|
-
return icon.value.size
|
|
233
|
+
return icon.value.size
|
|
155
234
|
} else {
|
|
156
|
-
return size.value ===
|
|
235
|
+
return size.value === 'large' ? 18 : size.value === 'medium' ? 14 : 10
|
|
157
236
|
}
|
|
158
|
-
})
|
|
237
|
+
})
|
|
159
238
|
/**
|
|
160
239
|
* @description 图标颜色
|
|
161
240
|
* */
|
|
162
241
|
const hyIconColor = computed(() => {
|
|
163
|
-
return icon.value.color
|
|
164
|
-
|
|
165
|
-
: plain.value
|
|
166
|
-
? type.value
|
|
167
|
-
: "#ffffff";
|
|
168
|
-
});
|
|
242
|
+
return icon.value.color ? icon.value.color : plain.value ? type.value : '#ffffff'
|
|
243
|
+
})
|
|
169
244
|
|
|
170
245
|
/**
|
|
171
246
|
* @description 点击关闭按钮
|
|
172
247
|
* */
|
|
173
248
|
const closeHandler = () => {
|
|
174
249
|
if (!disabled.value) {
|
|
175
|
-
emit(
|
|
250
|
+
emit('close', text.value)
|
|
176
251
|
}
|
|
177
|
-
}
|
|
252
|
+
}
|
|
178
253
|
/**
|
|
179
254
|
* @description 点击标签
|
|
180
255
|
* */
|
|
181
256
|
const clickHandler = () => {
|
|
182
257
|
if (!disabled.value) {
|
|
183
|
-
emit(
|
|
258
|
+
emit('click', {
|
|
184
259
|
value: text.value,
|
|
185
260
|
name: name.value,
|
|
186
|
-
})
|
|
261
|
+
})
|
|
187
262
|
}
|
|
188
|
-
}
|
|
263
|
+
}
|
|
189
264
|
</script>
|
|
190
265
|
|
|
191
266
|
<style lang="scss" scoped>
|
|
192
|
-
@import
|
|
267
|
+
@import './index.scss';
|
|
193
268
|
</style>
|
|
@@ -1,69 +1,77 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
2
|
-
import type HyIconProps from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
import type HyIconProps from '../hy-icon/typing'
|
|
3
3
|
|
|
4
4
|
export default interface HyTagProps {
|
|
5
5
|
/**
|
|
6
6
|
* @description 标签的文字内容
|
|
7
7
|
* */
|
|
8
|
-
text: string | number
|
|
8
|
+
text: string | number
|
|
9
9
|
/**
|
|
10
10
|
* @description 点击需要传得值
|
|
11
11
|
* */
|
|
12
|
-
name?: string | number
|
|
12
|
+
name?: string | number
|
|
13
13
|
/**
|
|
14
14
|
* @description 标签类型info、primary、success、warning、error (默认 'primary' )
|
|
15
15
|
* */
|
|
16
|
-
type?: HyApp.ThemeType
|
|
16
|
+
type?: HyApp.ThemeType
|
|
17
17
|
/**
|
|
18
18
|
* @description 禁用(默认 false )
|
|
19
19
|
* */
|
|
20
|
-
disabled?: boolean
|
|
20
|
+
disabled?: boolean
|
|
21
21
|
/**
|
|
22
22
|
* @description 标签的大小,large,medium,small (默认 'medium' )
|
|
23
23
|
* */
|
|
24
|
-
size?: HyApp.SizeType
|
|
24
|
+
size?: HyApp.SizeType
|
|
25
25
|
/**
|
|
26
26
|
* @description tag的形状,circle(两边半圆形), square(方形,带圆角)(默认 'square' )
|
|
27
27
|
* */
|
|
28
|
-
shape?: HyApp.ShapeType
|
|
28
|
+
shape?: HyApp.ShapeType
|
|
29
29
|
/**
|
|
30
30
|
* @description 背景颜色,默认为空字符串,即不处理
|
|
31
31
|
* */
|
|
32
|
-
bgColor?: string
|
|
32
|
+
bgColor?: string
|
|
33
33
|
/**
|
|
34
34
|
* @description 标签字体颜色,默认为空字符串,即不处理
|
|
35
35
|
* */
|
|
36
|
-
color?: string
|
|
36
|
+
color?: string
|
|
37
37
|
/**
|
|
38
38
|
* @description 镂空形式标签的边框颜色
|
|
39
39
|
* */
|
|
40
|
-
borderColor?: string
|
|
40
|
+
borderColor?: string
|
|
41
41
|
/**
|
|
42
42
|
* @description 关闭按钮图标的颜色(默认 #C6C7CB)
|
|
43
43
|
* */
|
|
44
|
-
closeColor?: string
|
|
44
|
+
closeColor?: string
|
|
45
45
|
/**
|
|
46
46
|
* @description 镂空时是否填充背景色(默认 false )
|
|
47
47
|
* */
|
|
48
|
-
plainFill?: boolean
|
|
48
|
+
plainFill?: boolean
|
|
49
49
|
/**
|
|
50
50
|
* @description 是否镂空(默认 false )
|
|
51
51
|
* */
|
|
52
|
-
plain?: boolean
|
|
52
|
+
plain?: boolean
|
|
53
53
|
/**
|
|
54
54
|
* @description 是否可关闭,设置为true,文字右边会出现一个关闭图标(默认 false )
|
|
55
55
|
* */
|
|
56
|
-
closable?: boolean
|
|
56
|
+
closable?: boolean
|
|
57
57
|
/**
|
|
58
58
|
* @description 标签显示与否(默认 true )
|
|
59
59
|
* */
|
|
60
|
-
show?: boolean
|
|
60
|
+
show?: boolean
|
|
61
61
|
/**
|
|
62
62
|
* @description 组件内置图标,或绝对路径的图片
|
|
63
63
|
* */
|
|
64
|
-
icon?: Partial<HyIconProps
|
|
64
|
+
icon?: Partial<HyIconProps>
|
|
65
65
|
/**
|
|
66
66
|
* @description 定义需要用到的外部样式
|
|
67
67
|
* */
|
|
68
|
-
customStyle?: CSSProperties
|
|
68
|
+
customStyle?: CSSProperties
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type TagParamsVo = { value: string; name: string }
|
|
72
|
+
export interface ITagEmits {
|
|
73
|
+
/** 点击标签触发 */
|
|
74
|
+
(e: 'click', params: TagParamsVo): void
|
|
75
|
+
/** 关闭标签触发 */
|
|
76
|
+
(e: 'close', value: string): void
|
|
69
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="hy-text" v-if="show" :style="wrapStyle" @tap="clickHandler">
|
|
2
|
+
<view :class="['hy-text', customClass]" v-if="show" :style="wrapStyle" @tap="clickHandler">
|
|
3
3
|
<text
|
|
4
4
|
:class="['hy-text__price', type && `hy-text__value--${type}`]"
|
|
5
5
|
v-if="mode === 'price'"
|
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
54
|
<script lang="ts">
|
|
55
|
+
/**
|
|
56
|
+
* 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
|
|
57
|
+
* @displayName hy-text
|
|
58
|
+
*/
|
|
59
|
+
defineOptions({})
|
|
55
60
|
export default {
|
|
56
61
|
name: 'hy-text',
|
|
57
62
|
options: {
|
|
@@ -63,15 +68,110 @@ export default {
|
|
|
63
68
|
</script>
|
|
64
69
|
|
|
65
70
|
<script setup lang="ts">
|
|
66
|
-
import { computed, type CSSProperties, nextTick, toRefs } from 'vue'
|
|
67
|
-
import type
|
|
68
|
-
import defaultProps from './props'
|
|
71
|
+
import { computed, type CSSProperties, nextTick, PropType, toRefs } from 'vue'
|
|
72
|
+
import type { ITextEmits } from './typing'
|
|
69
73
|
import { addUnit, error, formatName, formatTime, isDate, priceFormat } from '../../utils'
|
|
70
74
|
|
|
71
75
|
// 组件
|
|
72
76
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
73
77
|
|
|
74
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
78
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
79
|
+
const props = defineProps({
|
|
80
|
+
/** 显示的值 */
|
|
81
|
+
text: String,
|
|
82
|
+
/** 主题颜色 */
|
|
83
|
+
type: String,
|
|
84
|
+
/** 是否显示 */
|
|
85
|
+
show: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: true,
|
|
88
|
+
},
|
|
89
|
+
/** 前置图标 */
|
|
90
|
+
prefixIcon: String,
|
|
91
|
+
/** 后置图标 */
|
|
92
|
+
suffixIcon: String,
|
|
93
|
+
/**
|
|
94
|
+
* 文本处理的匹配模式
|
|
95
|
+
* @values text,price,phone,name,date,link
|
|
96
|
+
* */
|
|
97
|
+
mode: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: 'text',
|
|
100
|
+
},
|
|
101
|
+
/** mode=link下,配置的链接 */
|
|
102
|
+
href: String,
|
|
103
|
+
/** 格式化规则 */
|
|
104
|
+
format: String,
|
|
105
|
+
/** mode=phone时,点击文本是否拨打电话 */
|
|
106
|
+
call: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: false,
|
|
109
|
+
},
|
|
110
|
+
/** 小程序的打开方式 */
|
|
111
|
+
openType: String,
|
|
112
|
+
/** 是否粗体,默认normal */
|
|
113
|
+
bold: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: false,
|
|
116
|
+
},
|
|
117
|
+
/** 是否块状 */
|
|
118
|
+
block: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
/** 文本显示的行数,如果设置,超出此行数,将会显示省略号 */
|
|
123
|
+
lines: String,
|
|
124
|
+
/** 文本颜色 */
|
|
125
|
+
color: String,
|
|
126
|
+
/** 字体大小 */
|
|
127
|
+
size: {
|
|
128
|
+
type: Number,
|
|
129
|
+
default: 15,
|
|
130
|
+
},
|
|
131
|
+
/** 图标的样式 */
|
|
132
|
+
iconStyle: {
|
|
133
|
+
type: Object as unknown as PropType<CSSProperties>,
|
|
134
|
+
default() {
|
|
135
|
+
return {
|
|
136
|
+
fontSize: '15px',
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* 文字装饰,下划线,中划线等,可选值
|
|
142
|
+
* @values none,underline,line-through
|
|
143
|
+
* */
|
|
144
|
+
decoration: String,
|
|
145
|
+
/** 外边距,对象、字符串,数值形式均可 */
|
|
146
|
+
margin: String,
|
|
147
|
+
/** 文本行高 */
|
|
148
|
+
lineHeight: String,
|
|
149
|
+
/**
|
|
150
|
+
* 文本对齐方式
|
|
151
|
+
* @values left,center,right
|
|
152
|
+
* */
|
|
153
|
+
align: {
|
|
154
|
+
type: String,
|
|
155
|
+
default: 'left',
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* 文字换行
|
|
159
|
+
* @values normal,break-word,anywhere
|
|
160
|
+
* */
|
|
161
|
+
wordWrap: {
|
|
162
|
+
type: String,
|
|
163
|
+
default: 'normal',
|
|
164
|
+
},
|
|
165
|
+
/** 是否占满剩余空间 */
|
|
166
|
+
flex: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: true,
|
|
169
|
+
},
|
|
170
|
+
/** 定义需要用到的外部样式 */
|
|
171
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
172
|
+
/** 自定义外部类名 */
|
|
173
|
+
customClass: String,
|
|
174
|
+
})
|
|
75
175
|
const {
|
|
76
176
|
type,
|
|
77
177
|
show,
|
|
@@ -92,7 +192,7 @@ const {
|
|
|
92
192
|
format,
|
|
93
193
|
customStyle,
|
|
94
194
|
} = toRefs(props)
|
|
95
|
-
const emit = defineEmits(
|
|
195
|
+
const emit = defineEmits<ITextEmits>()
|
|
96
196
|
|
|
97
197
|
const wrapStyle = computed(() => {
|
|
98
198
|
const style: CSSProperties = {
|
|
@@ -1,98 +1,103 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
2
|
|
|
3
|
-
export type TextMode =
|
|
3
|
+
export type TextMode = 'text' | 'price' | 'phone' | 'name' | 'date' | 'link'
|
|
4
4
|
|
|
5
5
|
export default interface HyTextProps {
|
|
6
6
|
/**
|
|
7
7
|
* @description 显示的值
|
|
8
8
|
* */
|
|
9
|
-
text: string | number
|
|
9
|
+
text: string | number
|
|
10
10
|
/**
|
|
11
11
|
* @description 主题颜色
|
|
12
12
|
* */
|
|
13
|
-
type?: HyApp.ThemeType
|
|
13
|
+
type?: HyApp.ThemeType
|
|
14
14
|
/**
|
|
15
15
|
* @description 是否显示(默认 true )
|
|
16
16
|
* */
|
|
17
|
-
show?: boolean
|
|
17
|
+
show?: boolean
|
|
18
18
|
/**
|
|
19
19
|
* @description 前置图标
|
|
20
20
|
* */
|
|
21
|
-
prefixIcon?: string
|
|
21
|
+
prefixIcon?: string
|
|
22
22
|
/**
|
|
23
23
|
* @description 后置图标
|
|
24
24
|
* */
|
|
25
|
-
suffixIcon?: string
|
|
25
|
+
suffixIcon?: string
|
|
26
26
|
/**
|
|
27
27
|
* @description 文本处理的匹配模式 text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
|
|
28
28
|
* */
|
|
29
|
-
mode?: TextMode
|
|
29
|
+
mode?: TextMode
|
|
30
30
|
/**
|
|
31
31
|
* @description mode=link下,配置的链接
|
|
32
32
|
* */
|
|
33
|
-
href?: string
|
|
33
|
+
href?: string
|
|
34
34
|
/**
|
|
35
35
|
* @description 格式化规则
|
|
36
36
|
* */
|
|
37
|
-
format?: Function | string
|
|
37
|
+
format?: Function | string
|
|
38
38
|
/**
|
|
39
39
|
* @description mode=phone时,点击文本是否拨打电话(默认 false )
|
|
40
40
|
* */
|
|
41
|
-
call?: boolean
|
|
41
|
+
call?: boolean
|
|
42
42
|
/**
|
|
43
43
|
* @description 小程序的打开方式
|
|
44
44
|
* */
|
|
45
|
-
openType?: string
|
|
45
|
+
openType?: string
|
|
46
46
|
/**
|
|
47
47
|
* @description 是否粗体,默认normal(默认 false )
|
|
48
48
|
* */
|
|
49
|
-
bold?: boolean
|
|
49
|
+
bold?: boolean
|
|
50
50
|
/**
|
|
51
51
|
* @description 是否块状(默认 false )
|
|
52
52
|
* */
|
|
53
|
-
block?: boolean
|
|
53
|
+
block?: boolean
|
|
54
54
|
/**
|
|
55
55
|
* @description 文本显示的行数,如果设置,超出此行数,将会显示省略号
|
|
56
56
|
* */
|
|
57
|
-
lines?: string | number
|
|
57
|
+
lines?: string | number
|
|
58
58
|
/**
|
|
59
59
|
* @description 文本颜色(默认 '#303133' )
|
|
60
60
|
* */
|
|
61
|
-
color?: string
|
|
61
|
+
color?: string
|
|
62
62
|
/**
|
|
63
|
-
* @description
|
|
63
|
+
* @description 字体大小(默认 15 )
|
|
64
64
|
* */
|
|
65
|
-
size?: number | string
|
|
65
|
+
size?: number | string
|
|
66
66
|
/**
|
|
67
67
|
* @description 图标的样式 (默认 {fontSize: '15px'} )
|
|
68
68
|
* */
|
|
69
|
-
iconStyle?: CSSProperties
|
|
69
|
+
iconStyle?: CSSProperties
|
|
70
70
|
/**
|
|
71
71
|
* @description 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
|
|
72
72
|
* */
|
|
73
|
-
decoration?:
|
|
73
|
+
decoration?: '' | 'none' | 'underline' | 'line-through'
|
|
74
74
|
/**
|
|
75
75
|
* @description 外边距,对象、字符串,数值形式均可(默认 0 )
|
|
76
76
|
* */
|
|
77
|
-
margin?: string
|
|
77
|
+
margin?: string
|
|
78
78
|
/**
|
|
79
79
|
* @description 文本行高
|
|
80
80
|
* */
|
|
81
|
-
lineHeight?: string | number
|
|
81
|
+
lineHeight?: string | number
|
|
82
82
|
/**
|
|
83
83
|
* @description 文本对齐方式,可选值left|center|right(默认 'left' )
|
|
84
84
|
* */
|
|
85
|
-
align?: HyApp.RowCenterType
|
|
85
|
+
align?: HyApp.RowCenterType
|
|
86
86
|
/**
|
|
87
87
|
* @description 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
|
|
88
88
|
* */
|
|
89
|
-
wordWrap?:
|
|
89
|
+
wordWrap?: 'normal' | 'break-word' | 'anywhere'
|
|
90
90
|
/**
|
|
91
91
|
* @description 是否占满剩余空间(默认:true)
|
|
92
92
|
* */
|
|
93
|
-
flex?: boolean
|
|
93
|
+
flex?: boolean
|
|
94
94
|
/**
|
|
95
95
|
* @description 定义需要用到的外部样式
|
|
96
96
|
* */
|
|
97
|
-
customStyle?: CSSProperties
|
|
97
|
+
customStyle?: CSSProperties
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ITextEmits {
|
|
101
|
+
/** 点击触发 */
|
|
102
|
+
(e: 'click', event: any): void
|
|
98
103
|
}
|