hy-app 0.6.9 → 0.7.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.
- package/attributes.json +1 -1
- package/components/hy-avatar/hy-avatar.vue +12 -5
- package/components/hy-avatar/props.ts +4 -2
- package/components/hy-avatar/typing.d.ts +8 -1
- package/components/hy-calendar/hy-calendar.vue +3 -2
- package/components/hy-calendar/month.vue +25 -5
- package/components/hy-calendar/props.ts +1 -1
- package/components/hy-calendar/typing.d.ts +9 -0
- package/components/hy-cascader/hy-cascader.vue +503 -0
- package/components/hy-cascader/index.scss +84 -0
- package/components/hy-cascader/props.ts +88 -0
- package/components/hy-cascader/typing.d.ts +34 -0
- package/components/hy-check-button/typing.d.ts +12 -7
- package/components/hy-code-input/hy-code-input.vue +33 -11
- package/components/hy-code-input/typing.d.ts +4 -0
- package/components/hy-config-provider/hy-config-provider.vue +58 -53
- package/components/hy-count-down/hy-count-down.vue +8 -8
- package/components/hy-count-down/typing.d.ts +16 -0
- package/components/hy-count-to/hy-count-to.vue +7 -7
- package/components/hy-count-to/typing.d.ts +24 -0
- package/components/hy-datetime-picker/props.ts +1 -1
- package/components/hy-datetime-picker/typing.d.ts +1 -1
- package/components/hy-dropdown/typing.d.ts +5 -0
- package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -1
- package/components/hy-folding-panel/hy-folding-panel.vue +3 -3
- package/components/hy-folding-panel/typing.d.ts +23 -0
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -2
- package/components/hy-folding-panel-item/typing.d.ts +21 -0
- package/components/hy-form/hy-form.vue +2 -2
- package/components/hy-form/typing.d.ts +37 -0
- package/components/hy-form-item/typing.d.ts +1 -1
- package/components/hy-grid/hy-grid.vue +12 -12
- package/components/hy-grid/index.scss +1 -2
- package/components/hy-grid/props.ts +7 -2
- package/components/hy-grid/typing.d.ts +1 -1
- package/components/hy-icon/typing.d.ts +52 -9
- package/components/hy-keyboard/constants.ts +83 -0
- package/components/hy-keyboard/hy-keyboard.vue +375 -0
- package/components/hy-keyboard/index.scss +73 -0
- package/components/hy-keyboard/key/index.scss +79 -0
- package/components/hy-keyboard/key/index.vue +91 -0
- package/components/hy-keyboard/key/types.ts +1 -0
- package/components/hy-keyboard/props.ts +108 -0
- package/components/hy-keyboard/typing.d.ts +18 -0
- package/components/hy-list/hy-list.vue +15 -13
- package/components/hy-list/props.ts +1 -1
- package/components/hy-modal/typing.d.ts +2 -2
- package/components/hy-notice-bar/hy-column-notice.vue +54 -94
- package/components/hy-notice-bar/hy-notice-bar.vue +128 -96
- package/components/hy-notice-bar/hy-row-notice.vue +89 -121
- package/components/hy-notice-bar/props.ts +86 -85
- package/components/hy-notify/hy-notify.vue +10 -10
- package/components/hy-notify/typing.d.ts +35 -0
- package/components/hy-number-step/hy-number-step.vue +370 -367
- package/components/hy-number-step/index.scss +1 -0
- package/components/hy-number-step/props.ts +1 -1
- package/components/hy-picker/hy-picker.vue +126 -149
- package/components/hy-picker/props.ts +4 -1
- package/components/hy-picker/typing.d.ts +22 -0
- package/components/hy-popover/hy-popover.vue +2 -2
- package/components/hy-popover/typing.d.ts +1 -1
- package/components/hy-popup/hy-popup.vue +1 -1
- package/components/hy-popup/index.scss +1 -0
- package/components/hy-price/hy-price.vue +52 -23
- package/components/hy-price/props.ts +54 -54
- package/components/hy-radio/props.ts +1 -1
- package/components/hy-radio/typing.d.ts +5 -1
- package/components/hy-rolling-num/typing.d.ts +1 -0
- package/components/hy-signature/hy-signature.vue +17 -17
- package/components/hy-signature/typing.d.ts +1 -1
- package/components/hy-skeleton/index.scss +17 -0
- package/components/hy-steps/hy-steps.vue +1 -1
- package/components/hy-submit-bar/typing.d.ts +3 -3
- package/components/hy-swipe-action/hy-swipe-action.vue +34 -15
- package/components/hy-swipe-action/index.scss +0 -1
- package/components/hy-switch/typing.d.ts +4 -0
- package/components/hy-tabbar/props.ts +2 -1
- package/components/hy-tabbar/typing.d.ts +5 -4
- package/components/hy-tabs/hy-tabs.vue +338 -336
- package/components/hy-tabs/index.scss +6 -6
- package/components/hy-tabs/typing.d.ts +41 -33
- package/components/hy-textarea/hy-textarea.vue +2 -2
- package/components/hy-textarea/typing.d.ts +4 -0
- package/components/hy-toast/hy-toast.vue +17 -9
- package/components/hy-toast/index.scss +1 -1
- package/components/hy-toast/typing.d.ts +56 -37
- package/components/hy-tooltip/hy-tooltip.vue +1 -1
- package/components/hy-tooltip/index.scss +1 -0
- package/components/hy-tooltip/props.ts +1 -1
- package/components/hy-upload/hy-upload.vue +16 -1
- package/components/hy-upload/index.scss +149 -144
- package/components/index.ts +6 -0
- package/global.d.ts +2 -0
- package/libs/api/http.ts +122 -119
- package/libs/config/icon.ts +442 -430
- package/libs/css/_function.scss +7 -13
- package/libs/css/iconfont.css +445 -441
- package/libs/css/theme.scss +3 -1
- package/libs/locale/lang/en-US.ts +4 -0
- package/libs/locale/lang/zh-CN.ts +4 -0
- package/libs/typing/index.ts +80 -0
- package/package.json +5 -2
- package/tags.json +1 -1
- package/web-types.json +1 -1
- package/components/hy-folding-panel/hy-folding-panel-group.vue +0 -163
- package/components/hy-qrcode/qrcode.js.bak +0 -1434
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue'
|
|
2
|
+
import type { KeyboardMode, CarKeyboardLang } from './typing'
|
|
3
|
+
|
|
4
|
+
export const keyboardProps = {
|
|
5
|
+
/** 是否可见 */
|
|
6
|
+
show: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: false
|
|
9
|
+
},
|
|
10
|
+
/** 绑定的值 */
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ''
|
|
14
|
+
},
|
|
15
|
+
/** 标题 */
|
|
16
|
+
title: String,
|
|
17
|
+
/**
|
|
18
|
+
* 键盘模式
|
|
19
|
+
* @values default,custom,car,idcard
|
|
20
|
+
* */
|
|
21
|
+
mode: {
|
|
22
|
+
type: String as PropType<KeyboardMode>,
|
|
23
|
+
default: 'default'
|
|
24
|
+
},
|
|
25
|
+
/** 层级 */
|
|
26
|
+
zIndex: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 10086
|
|
29
|
+
},
|
|
30
|
+
/** 最大长度 */
|
|
31
|
+
maxlength: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: Infinity
|
|
34
|
+
},
|
|
35
|
+
/** 是否显示删除键 */
|
|
36
|
+
showDeleteKey: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
/** 是否显示小数点键 */
|
|
41
|
+
showDotKey: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true
|
|
44
|
+
},
|
|
45
|
+
/** 是否随机键盘按键顺序 */
|
|
46
|
+
randomKeyOrder: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
/** 确认按钮文本 */
|
|
51
|
+
closeText: String,
|
|
52
|
+
/** 删除按钮文本 */
|
|
53
|
+
deleteText: String,
|
|
54
|
+
/** 关闭按钮是否显示加载状态 */
|
|
55
|
+
closeButtonLoading: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
/** 是否显示蒙层 */
|
|
60
|
+
overlay: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true
|
|
63
|
+
},
|
|
64
|
+
/** 蒙层透明度 */
|
|
65
|
+
overlayOpacity: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: 0
|
|
68
|
+
},
|
|
69
|
+
/** 是否在点击外部时收起键盘 */
|
|
70
|
+
hideOnClickOutside: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
73
|
+
},
|
|
74
|
+
/** 是否锁定滚动 */
|
|
75
|
+
lockScroll: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true
|
|
78
|
+
},
|
|
79
|
+
/** 是否在底部安全区域内 */
|
|
80
|
+
safeAreaInsetBottom: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: true
|
|
83
|
+
},
|
|
84
|
+
/** 额外按键 */
|
|
85
|
+
extraKey: {
|
|
86
|
+
type: [String, Array] as PropType<string | string[]>,
|
|
87
|
+
default: ''
|
|
88
|
+
},
|
|
89
|
+
/** 车牌键盘语言模式 当mode=car时生效 */
|
|
90
|
+
carLang: {
|
|
91
|
+
type: String as PropType<CarKeyboardLang>,
|
|
92
|
+
default: ''
|
|
93
|
+
},
|
|
94
|
+
/** 是否自动切换车牌键盘语言 当mode=car且carLang是非受控状态时生效 */
|
|
95
|
+
autoSwitchLang: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
/** 定义需要用到的外部样式 */
|
|
100
|
+
customStyle: {
|
|
101
|
+
type: Object as PropType<Record<string, string | number>>,
|
|
102
|
+
default: () => ({})
|
|
103
|
+
},
|
|
104
|
+
/** 自定义外部类名 */
|
|
105
|
+
customClass: String
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type KeyboardProps = ExtractPropTypes<typeof keyboardProps>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type KeyboardMode = 'default' | 'custom' | 'car' | 'idcard'
|
|
2
|
+
export type KeyType = '' | 'delete' | 'extra' | 'close'
|
|
3
|
+
export type CarKeyboardLang = 'zh' | 'en'
|
|
4
|
+
|
|
5
|
+
export interface Key {
|
|
6
|
+
text?: number | string
|
|
7
|
+
type?: KeyType
|
|
8
|
+
wider?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IKeyboardEmits {
|
|
12
|
+
(e: 'update:show', value: boolean): void
|
|
13
|
+
(e: 'input', value: string): void
|
|
14
|
+
(e: 'close'): void
|
|
15
|
+
(e: 'delete'): void
|
|
16
|
+
(e: 'update:modelValue', value: string): void
|
|
17
|
+
(e: 'update:carLang', value: CarKeyboardLang): void
|
|
18
|
+
}
|
|
@@ -114,7 +114,6 @@ const waterfall: {
|
|
|
114
114
|
})
|
|
115
115
|
// 排列方式
|
|
116
116
|
const arrange = computed(() => (props.line === 1 ? 'column' : 'row'))
|
|
117
|
-
const boxHeight = getPx(props.itemHeight) + getPx(props.marginBottom)
|
|
118
117
|
const listHeight = addUnit(props.containerHeight)
|
|
119
118
|
const instance = getCurrentInstance()
|
|
120
119
|
|
|
@@ -125,6 +124,9 @@ onMounted(() => {
|
|
|
125
124
|
})
|
|
126
125
|
})
|
|
127
126
|
|
|
127
|
+
const boxHeight = computed(() => {
|
|
128
|
+
return getPx(props.itemHeight) + getPx(props.marginBottom)
|
|
129
|
+
})
|
|
128
130
|
const itemStyle = computed((): CSSProperties => {
|
|
129
131
|
return {
|
|
130
132
|
height: addUnit(props.itemHeight),
|
|
@@ -137,32 +139,32 @@ const itemStyle = computed((): CSSProperties => {
|
|
|
137
139
|
})
|
|
138
140
|
|
|
139
141
|
/**
|
|
140
|
-
*
|
|
142
|
+
* 虚拟列表真实展示数据:起始下标
|
|
141
143
|
*/
|
|
142
144
|
const start = computed(() => {
|
|
143
|
-
const s = Math.floor(scrollTop.value / boxHeight)
|
|
145
|
+
const s = Math.floor(scrollTop.value / boxHeight.value)
|
|
144
146
|
return Math.max(0, s * props.line)
|
|
145
147
|
})
|
|
146
148
|
|
|
147
149
|
/**
|
|
148
|
-
*
|
|
150
|
+
* 虚拟列表真实展示数据:结束下标
|
|
149
151
|
*/
|
|
150
152
|
const over = computed(() => {
|
|
151
|
-
const o = Math.floor((scrollTop.value + viewHeight.value + 1) / boxHeight + 5)
|
|
153
|
+
const o = Math.floor((scrollTop.value + viewHeight.value + 1) / boxHeight.value + 5)
|
|
152
154
|
return Math.min(props.list.length, o * props.line)
|
|
153
155
|
})
|
|
154
156
|
|
|
155
157
|
/**
|
|
156
|
-
*
|
|
158
|
+
* 计算虚拟列表的padding(保持列表高度完整且滚动条能正常滚动)
|
|
157
159
|
*/
|
|
158
160
|
const paddingAttr = computed(() => {
|
|
159
|
-
const paddingTop = start.value * boxHeight
|
|
160
|
-
const paddingBottom = (props.list.length - over.value) * boxHeight
|
|
161
|
+
const paddingTop = start.value * boxHeight.value
|
|
162
|
+
const paddingBottom = (props.list.length - over.value) * boxHeight.value
|
|
161
163
|
return `${paddingTop / props.line}px 0 ${paddingBottom / props.line}px`
|
|
162
164
|
})
|
|
163
165
|
|
|
164
166
|
/**
|
|
165
|
-
*
|
|
167
|
+
* 虚拟列表真实展示数据
|
|
166
168
|
*/
|
|
167
169
|
const virtualData = computed<(string | Record<string, any>)[]>(() => {
|
|
168
170
|
return props.list.slice(start.value, over.value)
|
|
@@ -187,28 +189,28 @@ watch(
|
|
|
187
189
|
)
|
|
188
190
|
|
|
189
191
|
/**
|
|
190
|
-
*
|
|
192
|
+
* 监听滚动条距离顶部距离,实时更新
|
|
191
193
|
*/
|
|
192
194
|
const onScroll = async (e: any) => {
|
|
193
195
|
scrollTop.value = e.detail.scrollTop || 0
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
/**
|
|
197
|
-
*
|
|
199
|
+
* 滚动底部函数
|
|
198
200
|
* */
|
|
199
201
|
const scrollToLower = () => {
|
|
200
202
|
emit('scrollToLower')
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
/**
|
|
204
|
-
*
|
|
206
|
+
* 点击行触发函数
|
|
205
207
|
* */
|
|
206
208
|
const handleClick = (temp: string | AnyObject) => {
|
|
207
209
|
emit('click', temp)
|
|
208
210
|
}
|
|
209
211
|
|
|
210
212
|
/**
|
|
211
|
-
*
|
|
213
|
+
* 获取默认插槽
|
|
212
214
|
*/
|
|
213
215
|
const slotDefault = useSlots().default
|
|
214
216
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue'
|
|
2
|
-
import modalProps from '
|
|
2
|
+
// import modalProps from './props'
|
|
3
3
|
|
|
4
|
-
export interface HyModalProps extends ExtractPropTypes<typeof modalProps> {}
|
|
4
|
+
// export interface HyModalProps extends ExtractPropTypes<typeof modalProps> {}
|
|
5
5
|
|
|
6
6
|
export interface IModalEmits {
|
|
7
7
|
/** 点击确认按钮时触发 */
|
|
@@ -1,94 +1,54 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:
|
|
14
|
-
class="hy-notice__swiper"
|
|
15
|
-
|
|
16
|
-
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const index = ref(0)
|
|
57
|
-
|
|
58
|
-
watch(
|
|
59
|
-
() => text.value,
|
|
60
|
-
(newVal) => !Array.isArray(newVal) && error('传入值必须是数组'),
|
|
61
|
-
{ immediate: true }
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @description 文字内容的样式
|
|
66
|
-
* */
|
|
67
|
-
const textStyle = computed<CSSProperties>(() => {
|
|
68
|
-
let style: CSSProperties = {}
|
|
69
|
-
style.color = color.value
|
|
70
|
-
style.fontSize = addUnit(fontSize.value)
|
|
71
|
-
return style
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
const noticeChange = (e: any) => {
|
|
75
|
-
index.value = e.detail.current
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @description 点击通告栏
|
|
80
|
-
* */
|
|
81
|
-
const clickHandler = (index: number) => {
|
|
82
|
-
emit('click', index)
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @description 点击关闭按钮
|
|
86
|
-
* */
|
|
87
|
-
const close = () => {
|
|
88
|
-
emit('close')
|
|
89
|
-
}
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<style lang="scss" scoped>
|
|
93
|
-
@import './index.scss';
|
|
94
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<swiper
|
|
3
|
+
:disable-touch="disableTouch"
|
|
4
|
+
:vertical="!step"
|
|
5
|
+
:circular="true"
|
|
6
|
+
:interval="duration"
|
|
7
|
+
:autoplay="true"
|
|
8
|
+
class="hy-notice__swiper"
|
|
9
|
+
@change="noticeChange"
|
|
10
|
+
>
|
|
11
|
+
<swiper-item
|
|
12
|
+
v-for="(item, index) in text"
|
|
13
|
+
:key="index"
|
|
14
|
+
class="hy-notice__swiper--item"
|
|
15
|
+
:style="{ justifyContent: justifyContent }"
|
|
16
|
+
>
|
|
17
|
+
<text class="hy-notice__swiper--item__text" :style="[textStyle]">{{ item }}</text>
|
|
18
|
+
</swiper-item>
|
|
19
|
+
</swiper>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { type CSSProperties, toRefs, computed, watch } from 'vue'
|
|
24
|
+
import noticeBarProps from './props'
|
|
25
|
+
import { addUnit, error } from '../../libs'
|
|
26
|
+
|
|
27
|
+
const props = defineProps(noticeBarProps)
|
|
28
|
+
const { text, fontSize, color } = toRefs(props)
|
|
29
|
+
const emit = defineEmits(['change'])
|
|
30
|
+
|
|
31
|
+
watch(
|
|
32
|
+
() => text.value,
|
|
33
|
+
(newVal) => !Array.isArray(newVal) && error('传入值必须是数组'),
|
|
34
|
+
{ immediate: true }
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description 文字内容的样式
|
|
39
|
+
* */
|
|
40
|
+
const textStyle = computed<CSSProperties>(() => {
|
|
41
|
+
let style: CSSProperties = {}
|
|
42
|
+
style.color = color.value
|
|
43
|
+
style.fontSize = addUnit(fontSize.value)
|
|
44
|
+
return style
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const noticeChange = (e: any) => {
|
|
48
|
+
emit('change', e.detail.current)
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style lang="scss" scoped>
|
|
53
|
+
@import './index.scss';
|
|
54
|
+
</style>
|
|
@@ -1,96 +1,128 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view
|
|
3
|
-
class="hy-notice-bar"
|
|
4
|
-
v-if="show"
|
|
5
|
-
:style="[
|
|
6
|
-
{
|
|
7
|
-
backgroundColor: bgColor
|
|
8
|
-
},
|
|
9
|
-
customStyle
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="`hy-notice-bar ${customClass}`"
|
|
4
|
+
v-if="show"
|
|
5
|
+
:style="[
|
|
6
|
+
{
|
|
7
|
+
backgroundColor: bgColor
|
|
8
|
+
},
|
|
9
|
+
customStyle
|
|
10
|
+
]"
|
|
11
|
+
>
|
|
12
|
+
<view class="hy-notice" @tap="clickHandler">
|
|
13
|
+
<!-- 左侧图标 -->
|
|
14
|
+
<slot name="icon">
|
|
15
|
+
<view class="hy-notice__left-icon" v-if="icon">
|
|
16
|
+
<hy-icon
|
|
17
|
+
:name="icon?.name || icon"
|
|
18
|
+
:color="icon?.color || color"
|
|
19
|
+
:size="icon?.size || 19"
|
|
20
|
+
></hy-icon>
|
|
21
|
+
</view>
|
|
22
|
+
</slot>
|
|
23
|
+
|
|
24
|
+
<!-- 中间内容区域 -->
|
|
25
|
+
<template v-if="direction === 'column' || (direction === 'row' && step)">
|
|
26
|
+
<hy-column-notice
|
|
27
|
+
:color="color"
|
|
28
|
+
:text="text"
|
|
29
|
+
:fontSize="fontSize"
|
|
30
|
+
:duration="duration"
|
|
31
|
+
:justifyContent="justifyContent"
|
|
32
|
+
:disable-touch="disableTouch"
|
|
33
|
+
:step="step"
|
|
34
|
+
@change="noticeChange"
|
|
35
|
+
></hy-column-notice>
|
|
36
|
+
</template>
|
|
37
|
+
<template v-else>
|
|
38
|
+
<hy-row-notice
|
|
39
|
+
:color="color"
|
|
40
|
+
:text="text"
|
|
41
|
+
:fontSize="fontSize"
|
|
42
|
+
:speed="speed"
|
|
43
|
+
@change="noticeChange"
|
|
44
|
+
></hy-row-notice>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<!-- 右侧图标 -->
|
|
48
|
+
<view class="hy-notice__right-icon" v-if="['link', 'closable'].includes(mode)">
|
|
49
|
+
<hy-icon
|
|
50
|
+
v-if="mode === 'link'"
|
|
51
|
+
:name="IconConfig.RIGHT"
|
|
52
|
+
:size="17"
|
|
53
|
+
:color="color"
|
|
54
|
+
></hy-icon>
|
|
55
|
+
<hy-icon
|
|
56
|
+
v-if="mode === 'closable'"
|
|
57
|
+
@click.stop="close"
|
|
58
|
+
:name="IconConfig.CLOSE"
|
|
59
|
+
:size="16"
|
|
60
|
+
:color="color"
|
|
61
|
+
></hy-icon>
|
|
62
|
+
</view>
|
|
63
|
+
</view>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script lang="ts">
|
|
68
|
+
export default {
|
|
69
|
+
name: 'hy-notice-bar',
|
|
70
|
+
options: {
|
|
71
|
+
addGlobalClass: true,
|
|
72
|
+
virtualHost: true,
|
|
73
|
+
styleIsolation: 'shared'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<script setup lang="ts">
|
|
79
|
+
import { ref } from 'vue'
|
|
80
|
+
import type { INoticeBarEmits } from './typing'
|
|
81
|
+
import noticeBarProps from './props'
|
|
82
|
+
import { IconConfig } from '../../libs'
|
|
83
|
+
// 组件
|
|
84
|
+
import HyRowNotice from './hy-row-notice.vue'
|
|
85
|
+
import HyColumnNotice from './hy-column-notice.vue'
|
|
86
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 该组件用于滚动通告场景,有多种模式可供选择
|
|
90
|
+
* @displayName hy-notice-bar
|
|
91
|
+
*/
|
|
92
|
+
defineOptions({})
|
|
93
|
+
|
|
94
|
+
const show = ref(true)
|
|
95
|
+
const currentIndex = ref(0)
|
|
96
|
+
|
|
97
|
+
const props = defineProps(noticeBarProps)
|
|
98
|
+
const emit = defineEmits<INoticeBarEmits>()
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @description 通告内容变化
|
|
102
|
+
* */
|
|
103
|
+
const noticeChange = (index: number) => {
|
|
104
|
+
currentIndex.value = index
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @description 点击通告栏
|
|
109
|
+
* */
|
|
110
|
+
const clickHandler = () => {
|
|
111
|
+
emit('click', currentIndex.value)
|
|
112
|
+
if (props.url && props.linkType && props.mode === 'link') {
|
|
113
|
+
;(uni as any)[props.linkType]({ url: props.url })
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @description 点击关闭按钮
|
|
119
|
+
* */
|
|
120
|
+
const close = () => {
|
|
121
|
+
show.value = false
|
|
122
|
+
emit('close')
|
|
123
|
+
}
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<style lang="scss" scoped>
|
|
127
|
+
@import './index.scss';
|
|
128
|
+
</style>
|