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.
Files changed (106) hide show
  1. package/attributes.json +1 -1
  2. package/components/hy-avatar/hy-avatar.vue +12 -5
  3. package/components/hy-avatar/props.ts +4 -2
  4. package/components/hy-avatar/typing.d.ts +8 -1
  5. package/components/hy-calendar/hy-calendar.vue +3 -2
  6. package/components/hy-calendar/month.vue +25 -5
  7. package/components/hy-calendar/props.ts +1 -1
  8. package/components/hy-calendar/typing.d.ts +9 -0
  9. package/components/hy-cascader/hy-cascader.vue +503 -0
  10. package/components/hy-cascader/index.scss +84 -0
  11. package/components/hy-cascader/props.ts +88 -0
  12. package/components/hy-cascader/typing.d.ts +34 -0
  13. package/components/hy-check-button/typing.d.ts +12 -7
  14. package/components/hy-code-input/hy-code-input.vue +33 -11
  15. package/components/hy-code-input/typing.d.ts +4 -0
  16. package/components/hy-config-provider/hy-config-provider.vue +58 -53
  17. package/components/hy-count-down/hy-count-down.vue +8 -8
  18. package/components/hy-count-down/typing.d.ts +16 -0
  19. package/components/hy-count-to/hy-count-to.vue +7 -7
  20. package/components/hy-count-to/typing.d.ts +24 -0
  21. package/components/hy-datetime-picker/props.ts +1 -1
  22. package/components/hy-datetime-picker/typing.d.ts +1 -1
  23. package/components/hy-dropdown/typing.d.ts +5 -0
  24. package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -1
  25. package/components/hy-folding-panel/hy-folding-panel.vue +3 -3
  26. package/components/hy-folding-panel/typing.d.ts +23 -0
  27. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -2
  28. package/components/hy-folding-panel-item/typing.d.ts +21 -0
  29. package/components/hy-form/hy-form.vue +2 -2
  30. package/components/hy-form/typing.d.ts +37 -0
  31. package/components/hy-form-item/typing.d.ts +1 -1
  32. package/components/hy-grid/hy-grid.vue +12 -12
  33. package/components/hy-grid/index.scss +1 -2
  34. package/components/hy-grid/props.ts +7 -2
  35. package/components/hy-grid/typing.d.ts +1 -1
  36. package/components/hy-icon/typing.d.ts +52 -9
  37. package/components/hy-keyboard/constants.ts +83 -0
  38. package/components/hy-keyboard/hy-keyboard.vue +375 -0
  39. package/components/hy-keyboard/index.scss +73 -0
  40. package/components/hy-keyboard/key/index.scss +79 -0
  41. package/components/hy-keyboard/key/index.vue +91 -0
  42. package/components/hy-keyboard/key/types.ts +1 -0
  43. package/components/hy-keyboard/props.ts +108 -0
  44. package/components/hy-keyboard/typing.d.ts +18 -0
  45. package/components/hy-list/hy-list.vue +15 -13
  46. package/components/hy-list/props.ts +1 -1
  47. package/components/hy-modal/typing.d.ts +2 -2
  48. package/components/hy-notice-bar/hy-column-notice.vue +54 -94
  49. package/components/hy-notice-bar/hy-notice-bar.vue +128 -96
  50. package/components/hy-notice-bar/hy-row-notice.vue +89 -121
  51. package/components/hy-notice-bar/props.ts +86 -85
  52. package/components/hy-notify/hy-notify.vue +10 -10
  53. package/components/hy-notify/typing.d.ts +35 -0
  54. package/components/hy-number-step/hy-number-step.vue +370 -367
  55. package/components/hy-number-step/index.scss +1 -0
  56. package/components/hy-number-step/props.ts +1 -1
  57. package/components/hy-picker/hy-picker.vue +126 -149
  58. package/components/hy-picker/props.ts +4 -1
  59. package/components/hy-picker/typing.d.ts +22 -0
  60. package/components/hy-popover/hy-popover.vue +2 -2
  61. package/components/hy-popover/typing.d.ts +1 -1
  62. package/components/hy-popup/hy-popup.vue +1 -1
  63. package/components/hy-popup/index.scss +1 -0
  64. package/components/hy-price/hy-price.vue +52 -23
  65. package/components/hy-price/props.ts +54 -54
  66. package/components/hy-radio/props.ts +1 -1
  67. package/components/hy-radio/typing.d.ts +5 -1
  68. package/components/hy-rolling-num/typing.d.ts +1 -0
  69. package/components/hy-signature/hy-signature.vue +17 -17
  70. package/components/hy-signature/typing.d.ts +1 -1
  71. package/components/hy-skeleton/index.scss +17 -0
  72. package/components/hy-steps/hy-steps.vue +1 -1
  73. package/components/hy-submit-bar/typing.d.ts +3 -3
  74. package/components/hy-swipe-action/hy-swipe-action.vue +34 -15
  75. package/components/hy-swipe-action/index.scss +0 -1
  76. package/components/hy-switch/typing.d.ts +4 -0
  77. package/components/hy-tabbar/props.ts +2 -1
  78. package/components/hy-tabbar/typing.d.ts +5 -4
  79. package/components/hy-tabs/hy-tabs.vue +338 -336
  80. package/components/hy-tabs/index.scss +6 -6
  81. package/components/hy-tabs/typing.d.ts +41 -33
  82. package/components/hy-textarea/hy-textarea.vue +2 -2
  83. package/components/hy-textarea/typing.d.ts +4 -0
  84. package/components/hy-toast/hy-toast.vue +17 -9
  85. package/components/hy-toast/index.scss +1 -1
  86. package/components/hy-toast/typing.d.ts +56 -37
  87. package/components/hy-tooltip/hy-tooltip.vue +1 -1
  88. package/components/hy-tooltip/index.scss +1 -0
  89. package/components/hy-tooltip/props.ts +1 -1
  90. package/components/hy-upload/hy-upload.vue +16 -1
  91. package/components/hy-upload/index.scss +149 -144
  92. package/components/index.ts +6 -0
  93. package/global.d.ts +2 -0
  94. package/libs/api/http.ts +122 -119
  95. package/libs/config/icon.ts +442 -430
  96. package/libs/css/_function.scss +7 -13
  97. package/libs/css/iconfont.css +445 -441
  98. package/libs/css/theme.scss +3 -1
  99. package/libs/locale/lang/en-US.ts +4 -0
  100. package/libs/locale/lang/zh-CN.ts +4 -0
  101. package/libs/typing/index.ts +80 -0
  102. package/package.json +5 -2
  103. package/tags.json +1 -1
  104. package/web-types.json +1 -1
  105. package/components/hy-folding-panel/hy-folding-panel-group.vue +0 -163
  106. 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
- * @description 虚拟列表真实展示数据:起始下标
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
- * @description 虚拟列表真实展示数据:结束下标
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
- * @description 计算虚拟列表的padding(保持列表高度完整且滚动条能正常滚动)
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
- * @description 虚拟列表真实展示数据
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
- * @description 监听滚动条距离顶部距离,实时更新
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
- * @description 滚动底部函数
199
+ * 滚动底部函数
198
200
  * */
199
201
  const scrollToLower = () => {
200
202
  emit('scrollToLower')
201
203
  }
202
204
 
203
205
  /**
204
- * @description 点击行触发函数
206
+ * 点击行触发函数
205
207
  * */
206
208
  const handleClick = (temp: string | AnyObject) => {
207
209
  emit('click', temp)
208
210
  }
209
211
 
210
212
  /**
211
- * @description 获取默认插槽
213
+ * 获取默认插槽
212
214
  */
213
215
  const slotDefault = useSlots().default
214
216
  </script>
@@ -19,7 +19,7 @@ const listProps = {
19
19
  /** 子容器的底部,会计算到容器内 */
20
20
  marginBottom: {
21
21
  type: [String, Number],
22
- default: 10
22
+ default: 0
23
23
  },
24
24
  /** 子容器的内边距 */
25
25
  padding: {
@@ -1,7 +1,7 @@
1
1
  import type { ExtractPropTypes } from 'vue'
2
- import modalProps from '@/package/components/hy-modal/props'
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
- <view class="hy-notice" @tap="clickHandler">
3
- <slot name="icon">
4
- <view class="hy-notice__left-icon" v-if="icon">
5
- <hy-icon :name="icon" :color="color" size="19"></hy-icon>
6
- </view>
7
- </slot>
8
- <swiper
9
- :disable-touch="disableTouch"
10
- :vertical="!step"
11
- :circular="true"
12
- :interval="duration"
13
- :autoplay="true"
14
- class="hy-notice__swiper"
15
- @change="noticeChange"
16
- >
17
- <swiper-item
18
- v-for="(item, index) in text"
19
- :key="index"
20
- class="hy-notice__swiper--item"
21
- :style="{ justifyContent: justifyContent }"
22
- >
23
- <text class="hy-notice__swiper--item__text" :style="[textStyle]">{{ item }}</text>
24
- </swiper-item>
25
- </swiper>
26
- <view class="hy-notice__right-icon" v-if="['link', 'closable'].includes(mode)">
27
- <hy-icon
28
- v-if="mode === 'link'"
29
- :name="IconConfig.RIGHT"
30
- :size="17"
31
- :color="color"
32
- ></hy-icon>
33
- <hy-icon
34
- v-if="mode === 'closable'"
35
- :name="IconConfig.CLOSE"
36
- :size="16"
37
- :color="color"
38
- @click="close"
39
- ></hy-icon>
40
- </view>
41
- </view>
42
- </template>
43
-
44
- <script setup lang="ts">
45
- import { type CSSProperties, toRefs, computed, ref, watch } from 'vue'
46
- import noticeBarProps from './props'
47
- import { addUnit, error, IconConfig } from '../../libs'
48
-
49
- // 组件
50
- import HyIcon from '../hy-icon/hy-icon.vue'
51
-
52
- const props = defineProps(noticeBarProps)
53
- const { text, fontSize, color } = toRefs(props)
54
- const emit = defineEmits(['click', 'close'])
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
- <template v-if="direction === 'column' || (direction === 'row' && step)">
13
- <HyColumnNotice
14
- :color="color"
15
- :bgColor="bgColor"
16
- :text="text"
17
- :mode="mode"
18
- :step="step"
19
- :icon="icon"
20
- :disable-touch="disableTouch"
21
- :fontSize="fontSize"
22
- :duration="duration"
23
- :justifyContent="justifyContent"
24
- @close="close"
25
- @click="click"
26
- ></HyColumnNotice>
27
- </template>
28
- <template v-else>
29
- <HyRowNotice
30
- :color="color"
31
- :bgColor="bgColor"
32
- :text="text"
33
- :mode="mode"
34
- :fontSize="fontSize"
35
- :speed="speed"
36
- :url="url"
37
- :linkType="linkType"
38
- :icon="icon"
39
- @close="close"
40
- @click="click"
41
- ></HyRowNotice>
42
- </template>
43
- </view>
44
- </template>
45
-
46
- <script lang="ts">
47
- export default {
48
- name: 'hy-notice-bar',
49
- options: {
50
- addGlobalClass: true,
51
- virtualHost: true,
52
- styleIsolation: 'shared'
53
- }
54
- }
55
- </script>
56
-
57
- <script setup lang="ts">
58
- import { ref } from 'vue'
59
- import type { INoticeBarEmits } from './typing'
60
- import noticeBarProps from './props'
61
- // 组件
62
- import HyRowNotice from './hy-row-notice.vue'
63
- import HyColumnNotice from './hy-column-notice.vue'
64
-
65
- /**
66
- * 该组件用于滚动通告场景,有多种模式可供选择
67
- * @displayName hy-notice-bar
68
- */
69
- defineOptions({})
70
-
71
- const show = ref(true)
72
-
73
- const props = defineProps(noticeBarProps)
74
- const emit = defineEmits<INoticeBarEmits>()
75
-
76
- /**
77
- * @description 点击通告栏
78
- * */
79
- const click = (index: number) => {
80
- emit('click', index)
81
- if (props.url && props.linkType && props.mode === 'link') {
82
- ;(uni as any)[props.linkType]({ url: props.url })
83
- }
84
- }
85
- /**
86
- * @description 点击关闭按钮
87
- * */
88
- const close = () => {
89
- show.value = false
90
- emit('close')
91
- }
92
- </script>
93
-
94
- <style lang="scss" scoped>
95
- @import './index.scss';
96
- </style>
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>