hy-app 0.6.8 → 0.7.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/attributes.json +1 -1
- package/components/hy-action-sheet/index.scss +2 -2
- package/components/hy-avatar/hy-avatar.vue +12 -5
- package/components/hy-avatar/index.scss +2 -2
- package/components/hy-avatar/props.ts +4 -2
- package/components/hy-avatar/typing.d.ts +8 -1
- package/components/hy-calendar/hy-calendar.vue +1 -0
- package/components/hy-calendar/month.vue +25 -5
- package/components/hy-calendar/props.ts +1 -1
- 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-cell-item/index.scss +8 -9
- 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/index.scss +2 -2
- package/components/hy-code-input/typing.d.ts +4 -0
- package/components/hy-config-provider/hy-config-provider.vue +58 -53
- package/components/hy-config-provider/props.ts +1 -1
- 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-float-button/index.scss +1 -1
- package/components/hy-form/typing.d.ts +6 -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-index-bar/index.scss +1 -1
- 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-line-progress/index.scss +3 -3
- package/components/hy-menu/index.scss +1 -1
- package/components/hy-modal/index.scss +2 -2
- 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/index.scss +1 -1
- package/components/hy-notice-bar/props.ts +86 -85
- package/components/hy-notify/hy-notify.vue +9 -9
- package/components/hy-notify/typing.d.ts +22 -0
- 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/index.scss +6 -6
- package/components/hy-popup/index.scss +6 -5
- 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-scroll-list/index.scss +2 -2
- package/components/hy-search/index.scss +1 -1
- package/components/hy-signature/index.scss +1 -1
- package/components/hy-skeleton/index.scss +21 -4
- package/components/hy-slider/index.scss +3 -3
- package/components/hy-steps/hy-steps.vue +1 -1
- package/components/hy-steps/index.scss +3 -3
- package/components/hy-submit-bar/typing.d.ts +3 -3
- package/components/hy-subsection/index.scss +8 -8
- package/components/hy-swipe-action/hy-swipe-action.vue +34 -15
- package/components/hy-swipe-action/index.scss +0 -1
- package/components/hy-swiper/index.scss +2 -2
- package/components/hy-switch/index.scss +3 -3
- 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-tabbar-group/index.scss +2 -2
- package/components/hy-tabs/hy-tabs.vue +338 -336
- package/components/hy-tabs/index.scss +7 -7
- package/components/hy-tabs/typing.d.ts +41 -33
- package/components/hy-tag/index.scss +1 -1
- package/components/hy-textarea/hy-textarea.vue +2 -2
- package/components/hy-textarea/index.scss +4 -4
- package/components/hy-textarea/typing.d.ts +4 -0
- package/components/hy-toast/hy-toast.vue +14 -6
- package/components/hy-toast/index.scss +1 -1
- package/components/hy-toast/typing.d.ts +42 -36
- package/components/hy-tooltip/hy-tooltip.vue +1 -1
- package/components/hy-tooltip/index.scss +7 -6
- 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/hy-warn/index.scss +1 -1
- package/components/index.ts +6 -0
- package/global.d.ts +2 -0
- package/libs/config/icon.ts +442 -430
- package/libs/css/_function.scss +7 -13
- package/libs/css/_mixin.scss +3 -3
- package/libs/css/common.scss +1 -1
- package/libs/css/iconfont.css +445 -441
- package/libs/css/theme.scss +54 -25
- 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-qrcode/qrcode.js.bak +0 -1434
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 键盘按键组件 -->
|
|
3
|
+
<view
|
|
4
|
+
:class="[
|
|
5
|
+
'hy-keyboard__key',
|
|
6
|
+
{
|
|
7
|
+
'hy-keyboard__key--wider': wider, // 加宽样式
|
|
8
|
+
'hy-keyboard__key--large': large, // 大号样式(用于侧边栏)
|
|
9
|
+
'hy-keyboard__key--car': isCar, // 车牌号键盘样式
|
|
10
|
+
'hy-keyboard__key--delete': type === 'delete', // 删除键样式
|
|
11
|
+
'hy-keyboard__key--extra': type === 'extra', // 额外按键样式
|
|
12
|
+
'hy-keyboard__key--close': type === 'close' // 关闭键样式
|
|
13
|
+
}
|
|
14
|
+
]"
|
|
15
|
+
@click="handlePress"
|
|
16
|
+
>
|
|
17
|
+
<!-- 按键文本 -->
|
|
18
|
+
<text class="hy-keyboard__key-text">{{ text }}</text>
|
|
19
|
+
<!-- 删除键图标 -->
|
|
20
|
+
<view v-if="type === 'delete'" class="hy-keyboard__delete-icon">
|
|
21
|
+
<view class="hy-keyboard__delete-line hy-keyboard__delete-line--left">
|
|
22
|
+
<hy-icon
|
|
23
|
+
v-if="type === 'delete'"
|
|
24
|
+
:name="IconConfig.CLEAR"
|
|
25
|
+
class="hy-keyboard__key-icon"
|
|
26
|
+
color="#fff"
|
|
27
|
+
size="28"
|
|
28
|
+
/>
|
|
29
|
+
</view>
|
|
30
|
+
<view class="hy-keyboard__delete-line hy-keyboard__delete-line--right"></view>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
export default {
|
|
37
|
+
name: 'hy-keyboard-key',
|
|
38
|
+
options: {
|
|
39
|
+
virtualHost: true,
|
|
40
|
+
addGlobalClass: true,
|
|
41
|
+
styleIsolation: 'shared'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<script lang="ts" setup>
|
|
47
|
+
import { IconConfig } from '@/package/libs'
|
|
48
|
+
import type { NumberKeyType } from './types'
|
|
49
|
+
|
|
50
|
+
const props = defineProps({
|
|
51
|
+
/** 按键显示文本 */
|
|
52
|
+
text: {
|
|
53
|
+
type: [String, Number],
|
|
54
|
+
default: ''
|
|
55
|
+
},
|
|
56
|
+
/** 按键类型: delete(删除), extra(额外), close(关闭), ''(普通) */
|
|
57
|
+
type: {
|
|
58
|
+
type: String as () => NumberKeyType,
|
|
59
|
+
default: ''
|
|
60
|
+
},
|
|
61
|
+
/** 是否加宽(用于车牌号键盘的特殊按键) */
|
|
62
|
+
wider: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
/** 是否大号(用于侧边栏按键) */
|
|
67
|
+
large: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
/** 是否车牌号键盘的按键 */
|
|
72
|
+
isCar: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const emit = defineEmits(['press'])
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 处理按键点击
|
|
82
|
+
* 触发 press 事件,传递按键文本和类型
|
|
83
|
+
*/
|
|
84
|
+
const handlePress = () => {
|
|
85
|
+
emit('press', props.text, props.type)
|
|
86
|
+
}
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style lang="scss">
|
|
90
|
+
@import './index.scss';
|
|
91
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type NumberKeyType = '' | 'delete' | 'extra' | 'close'
|
|
@@ -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
|
+
}
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
flex: 1;
|
|
9
9
|
width: 100%;
|
|
10
10
|
overflow: hidden;
|
|
11
|
-
border-radius: $hy-
|
|
11
|
+
border-radius: $hy-radius-semicircle;
|
|
12
12
|
|
|
13
13
|
@include e(background) {
|
|
14
14
|
background-color: $hy-background--empty;
|
|
15
|
-
border-radius: $hy-
|
|
15
|
+
border-radius: $hy-radius-semicircle;
|
|
16
16
|
flex: 1;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
align-items: center;
|
|
25
25
|
@include flex(row);
|
|
26
26
|
color: #ffffff;
|
|
27
|
-
border-radius: $hy-
|
|
27
|
+
border-radius: $hy-radius-semicircle;
|
|
28
28
|
transition: width 0.5s ease;
|
|
29
29
|
justify-content: flex-end;
|
|
30
30
|
background-color: $hy-primary;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
@include b(modal) {
|
|
5
5
|
max-width: 650rpx;
|
|
6
|
-
border-radius: $hy-
|
|
6
|
+
border-radius: $hy-radius-base;
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
|
|
9
9
|
/* 标题 */
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
justify-content: center;
|
|
66
66
|
align-items: center;
|
|
67
67
|
height: 43px;
|
|
68
|
-
border-radius: $hy-
|
|
68
|
+
border-radius: $hy-radius-semicircle;
|
|
69
69
|
|
|
70
70
|
/* 确认 */
|
|
71
71
|
@include m(confirm) {
|
|
@@ -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>
|