hy-app 0.5.3 → 0.5.5

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 (121) hide show
  1. package/components/hy-action-sheet/typing.d.ts +1 -63
  2. package/components/hy-address-picker/hy-address-picker.vue +7 -6
  3. package/components/hy-address-picker/typing.d.ts +0 -84
  4. package/components/hy-avatar/hy-avatar.vue +4 -3
  5. package/components/hy-avatar/typing.d.ts +0 -66
  6. package/components/hy-back-top/typing.d.ts +0 -47
  7. package/components/hy-badge/hy-badge.vue +3 -3
  8. package/components/hy-badge/index.scss +0 -1
  9. package/components/hy-badge/props.ts +6 -1
  10. package/components/hy-badge/typing.d.ts +0 -62
  11. package/components/hy-button/typing.d.ts +28 -162
  12. package/components/hy-calendar/hy-calendar.vue +2 -2
  13. package/components/hy-calendar/typing.d.ts +0 -128
  14. package/components/hy-card/hy-card.vue +12 -12
  15. package/components/hy-card/index.scss +17 -5
  16. package/components/hy-card/props.ts +1 -2
  17. package/components/hy-card/typing.d.ts +1 -114
  18. package/components/hy-cell/props.ts +1 -1
  19. package/components/hy-cell/typing.d.ts +0 -55
  20. package/components/hy-check-button/typing.d.ts +0 -43
  21. package/components/hy-checkbox/typing.d.ts +1 -73
  22. package/components/hy-checkbox-group/typing.d.ts +0 -65
  23. package/components/hy-code-input/typing.d.ts +0 -70
  24. package/components/hy-count-down/typing.d.ts +1 -20
  25. package/components/hy-count-to/typing.d.ts +0 -47
  26. package/components/hy-coupon/index.scss +7 -2
  27. package/components/hy-coupon/props.ts +7 -4
  28. package/components/hy-coupon/typing.d.ts +1 -134
  29. package/components/hy-datetime-picker/props.ts +1 -3
  30. package/components/hy-datetime-picker/typing.d.ts +0 -119
  31. package/components/hy-dropdown-item/typing.d.ts +12 -31
  32. package/components/hy-empty/typing.d.ts +1 -59
  33. package/components/hy-float-button/typing.d.ts +24 -113
  34. package/components/hy-folding-panel/props.ts +1 -1
  35. package/components/hy-folding-panel/typing.d.ts +0 -38
  36. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -3
  37. package/components/hy-folding-panel-item/typing.d.ts +14 -0
  38. package/components/hy-form/typing.d.ts +0 -27
  39. package/components/hy-form-item/hy-form-item.vue +7 -5
  40. package/components/hy-form-item/typing.d.ts +0 -19
  41. package/components/hy-grid/typing.d.ts +0 -43
  42. package/components/hy-icon/hy-icon.vue +3 -8
  43. package/components/hy-icon/typing.d.ts +0 -86
  44. package/components/hy-image/typing.d.ts +0 -80
  45. package/components/hy-input/typing.d.ts +0 -149
  46. package/components/hy-list/props.ts +1 -1
  47. package/components/hy-list/typing.d.ts +0 -51
  48. package/components/hy-menu/typing.d.ts +0 -35
  49. package/components/hy-modal/typing.d.ts +9 -84
  50. package/components/hy-navbar/typing.d.ts +0 -81
  51. package/components/hy-notice-bar/typing.d.ts +2 -65
  52. package/components/hy-number-step/typing.d.ts +0 -110
  53. package/components/hy-overlay/typing.d.ts +2 -27
  54. package/components/hy-pagination/typing.d.ts +6 -49
  55. package/components/hy-picker/typing.d.ts +27 -124
  56. package/components/hy-popover/typing.d.ts +25 -66
  57. package/components/hy-popup/hy-popup.vue +0 -1
  58. package/components/hy-popup/typing.d.ts +8 -77
  59. package/components/hy-price/typing.d.ts +0 -41
  60. package/components/hy-qrcode/hy-qrcode.vue +67 -2
  61. package/components/hy-qrcode/index.scss +3 -4
  62. package/components/hy-qrcode/typing.d.ts +0 -66
  63. package/components/hy-radio/typing.d.ts +1 -86
  64. package/components/hy-rate/typing.d.ts +0 -62
  65. package/components/hy-read-more/typing.d.ts +4 -49
  66. package/components/hy-scroll-list/typing.d.ts +4 -33
  67. package/components/hy-search/typing.d.ts +19 -120
  68. package/components/hy-signature/hy-signature.vue +25 -22
  69. package/components/hy-signature/index.scss +0 -4
  70. package/components/hy-signature/typing.d.ts +0 -101
  71. package/components/hy-slider/typing.d.ts +8 -77
  72. package/components/hy-steps/typing.d.ts +16 -60
  73. package/components/hy-submit-bar/typing.d.ts +0 -72
  74. package/components/hy-subsection/typing.d.ts +0 -49
  75. package/components/hy-swipe-action/index.ts +13 -22
  76. package/components/hy-swipe-action/typing.d.ts +1 -38
  77. package/components/hy-swiper/typing.d.ts +0 -101
  78. package/components/hy-switch/typing.d.ts +0 -62
  79. package/components/hy-tabbar/hy-tabbar.vue +137 -0
  80. package/components/{hy-tabBar → hy-tabbar}/index.scss +31 -31
  81. package/components/hy-tabbar/props.ts +59 -0
  82. package/components/hy-tabbar/typing.d.ts +21 -0
  83. package/components/hy-tabbar-group/hy-tabbar-group.vue +87 -0
  84. package/components/hy-tabbar-group/index.scss +57 -0
  85. package/components/hy-tabbar-group/props.ts +78 -0
  86. package/components/hy-tabbar-group/typing.ts +16 -0
  87. package/components/hy-tabbar-item/hy-tabbar-item.vue +103 -0
  88. package/components/hy-tabbar-item/index.scss +43 -0
  89. package/components/hy-tabbar-item/props.ts +24 -0
  90. package/components/hy-tabbar-item/typing.ts +10 -0
  91. package/components/hy-tabs/typing.d.ts +25 -92
  92. package/components/hy-tag/props.ts +8 -2
  93. package/components/hy-tag/typing.d.ts +9 -78
  94. package/components/hy-text/props.ts +8 -2
  95. package/components/hy-text/typing.d.ts +3 -100
  96. package/components/hy-textarea/props.ts +4 -1
  97. package/components/hy-textarea/typing.d.ts +0 -27
  98. package/components/hy-tooltip/props.ts +1 -4
  99. package/components/hy-tooltip/typing.d.ts +2 -55
  100. package/components/hy-transition/typing.d.ts +14 -43
  101. package/components/hy-upload/props.ts +1 -1
  102. package/components/hy-upload/typing.d.ts +56 -164
  103. package/components/hy-warn/typing.d.ts +4 -45
  104. package/components/index.ts +177 -177
  105. package/global.d.ts +87 -85
  106. package/package.json +2 -2
  107. package/web-types.json +1 -1
  108. package/components/hy-config-provider/typing.d.ts +0 -24
  109. package/components/hy-divider/typing.d.ts +0 -64
  110. package/components/hy-dropdown/typing.d.ts +0 -48
  111. package/components/hy-form-group/typing.d.ts +0 -0
  112. package/components/hy-line/typing.d.ts +0 -32
  113. package/components/hy-line-progress/typing.d.ts +0 -32
  114. package/components/hy-loading/typing.d.ts +0 -52
  115. package/components/hy-notify/typing.d.ts +0 -48
  116. package/components/hy-status-bar/typing.d.ts +0 -12
  117. package/components/hy-tabBar/hy-tabBar.vue +0 -109
  118. package/components/hy-tabBar/props.ts +0 -13
  119. package/components/hy-tabBar/typing.d.ts +0 -54
  120. package/components/hy-waterfall/typing.d.ts +0 -14
  121. package/components/hy-watermark/typing.d.ts +0 -76
@@ -1,65 +1,21 @@
1
- import type { CSSProperties } from 'vue'
2
-
3
1
  export interface StepListVo {
4
- /**
5
- * @description 标题
6
- * */
7
- title?: string
8
- /**
9
- * @description 描述
10
- * */
11
- desc?: string
12
- /**
13
- * @description 是否错误
14
- * */
15
- error?: boolean
16
- }
17
- export default interface HyStepsProps {
18
- /**
19
- * @description 设置当前处于第几步 (默认 0 )
20
- * */
21
- current: number
22
- /**
23
- * @description 步骤条的数据集
24
- * */
25
- list: StepListVo[]
26
- /**
27
- * @description row-横向,column-竖向 (默认 'row' )
28
- * */
29
- direction?: HyApp.DirectionType
30
- /**
31
- * @description 激活状态颜色 (默认 '#3c9cff' )
32
- * */
33
- activeColor?: string
34
- /**
35
- * @description 未激活状态颜色 (默认 '#969799' )
36
- * */
37
- inactiveColor?: string
38
- /**
39
- * @description 激活状态的图标
40
- * */
41
- activeIcon?: string
42
- /**
43
- * @description 未激活状态图标
44
- * */
45
- inactiveIcon?: string
46
- /**
47
- * @description 是否显示点类型 (默认 false )
48
- * */
49
- dot?: boolean
50
- /**
51
- * @description 图标大小 (默认 17 )
52
- * */
53
- iconSize?: string | number
54
- /**
55
- * @description 定义需要用到的外部样式
56
- * */
57
- customStyle?: CSSProperties
2
+ /**
3
+ * @description 标题
4
+ * */
5
+ title?: string
6
+ /**
7
+ * @description 描述
8
+ * */
9
+ desc?: string
10
+ /**
11
+ * @description 是否错误
12
+ * */
13
+ error?: boolean
58
14
  }
59
15
 
60
16
  export interface IStepsEmits {
61
- /** 值改成触发 */
62
- (e: 'change', index: number): void
63
- /** 值改成触发 */
64
- (e: 'update:current', index: number): void
17
+ /** 值改成触发 */
18
+ (e: 'change', index: number): void
19
+ /** 值改成触发 */
20
+ (e: 'update:current', index: number): void
65
21
  }
@@ -1,4 +1,3 @@
1
- import type { CSSProperties } from 'vue'
2
1
  import type BadgeProps from '../hy-badge/props'
3
2
 
4
3
  export interface SubmitBarIconMenus {
@@ -17,77 +16,6 @@ export interface SubmitBarIconMenus {
17
16
  [key: string]: any
18
17
  }
19
18
 
20
- export default interface HySubmitBarProps {
21
- /**
22
- * @description 左边菜单栏
23
- * */
24
- menus?: IconMenus[]
25
- /**
26
- * @description 绝对定位
27
- * */
28
- fixed?: boolean
29
- /**
30
- * @description 是否显示边框
31
- * */
32
- border?: boolean
33
- /**
34
- * @description 加载左边按钮loading
35
- * */
36
- leftLoading?: boolean
37
- /**
38
- * @description 加载右边按钮loading
39
- * */
40
- rightLoading?: boolean
41
- /**
42
- * @description 左边icon的颜色
43
- * */
44
- iconColor?: string
45
- /**
46
- * @description 左边文字的颜色
47
- * */
48
- iconLabelColor?: string
49
- /**
50
- * @description 右边按钮文字颜色
51
- * */
52
- textColor?: string
53
- /**
54
- * @description 显示左边按钮
55
- * */
56
- showLeftBtn?: boolean
57
- /**
58
- * @description 显示右边按钮
59
- * */
60
- showRightBtn?: boolean
61
- /**
62
- * @description 左边按钮文字
63
- * */
64
- leftBtnText?: string
65
- /**
66
- * @description 右边按钮文字
67
- * */
68
- rightBtnText?: string
69
- /**
70
- * @description 左边按钮颜色,支持渐变色
71
- * */
72
- leftBtnColor?: string
73
- /**
74
- * @description 有边按钮颜色,支持渐变色
75
- * */
76
- rightBtnColor?: string
77
- /**
78
- * @description 按钮的形状
79
- * */
80
- shape?: HyApp.ShapeType
81
- /**
82
- * @description 按钮点击等待时长(运用了节流方法)
83
- * */
84
- warn?: number
85
- /**
86
- * @description 定义需要用到的外部样式
87
- * */
88
- customStyle?: CSSProperties
89
- }
90
-
91
19
  export interface ISubmitBarEmits {
92
20
  /** 点击按钮触发 */
93
21
  (e: 'click', index: number): void
@@ -1,5 +1,3 @@
1
- import type { CSSProperties } from 'vue'
2
-
3
1
  export interface SubSectionItemVo extends AnyObject {
4
2
  name: string
5
3
  value: string | number
@@ -7,53 +5,6 @@ export interface SubSectionItemVo extends AnyObject {
7
5
 
8
6
  export type SubSectionVo = string | number | SubSectionItemVo
9
7
 
10
- export default interface HySubsectionProps {
11
- /**
12
- * @description 接收值
13
- * */
14
- modelValue: string | number
15
- /**
16
- * @description 默认值 (默认0)
17
- * */
18
- current?: number
19
- /**
20
- * @description tab的数据
21
- * */
22
- list: SubSectionVo[]
23
- /**
24
- * @description list的键值
25
- * */
26
- customKeys?: HyApp.IFieldNames
27
- /**
28
- * @description 激活时的颜色(默认 '#3c9cff' )
29
- * */
30
- activeColor?: string
31
- /**
32
- * @description 未激活时的颜色(默认 '#303133' )
33
- * */
34
- inactiveColor?: string
35
- /**
36
- * @description 模式选择,mode=button为按钮形式,mode=subsection时为分段模式(默认 'button' )
37
- * */
38
- mode?: 'button' | 'subsection'
39
- /**
40
- * @description 字体大小,单位px(默认 12 )
41
- * */
42
- fontSize?: number | string
43
- /**
44
- * @description 激活选项的字体是否加粗(默认 true )
45
- * */
46
- bold?: boolean
47
- /**
48
- * @description 组件背景颜色,mode为button时有效(默认 '#eeeeef' )
49
- * */
50
- bgColor?: string
51
- /**
52
- * @description 定义需要用到的外部样式
53
- * */
54
- customStyle?: CSSProperties
55
- }
56
-
57
8
  export interface ISubsectionEmits {
58
9
  /** 改变触发 */
59
10
  (e: 'change', index: number): void
@@ -1,34 +1,25 @@
1
- /*
2
- * @Author: weisheng
3
- * @Date: 2023-07-02 22:51:06
4
- * @LastEditTime: 2024-03-16 19:59:07
5
- * @LastEditors: weisheng
6
- * @Description:
7
- * @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/common/clickoutside.ts
8
- * 记得注释
9
- */
10
- let queue: any[] = [];
1
+ let queue: any[] = []
11
2
 
12
3
  export function pushToQueue(comp: any) {
13
- queue.push(comp);
4
+ queue.push(comp)
14
5
  }
15
6
 
16
7
  export function removeFromQueue(comp: any) {
17
- queue = queue.filter((item) => {
18
- return item.$.uid !== comp.$.uid;
19
- });
8
+ queue = queue.filter((item) => {
9
+ return item.$.uid !== comp.$.uid
10
+ })
20
11
  }
21
12
 
22
13
  export function closeOther(comp: any) {
23
- queue.forEach((item) => {
24
- if (item.$.uid !== comp.$.uid) {
25
- item.$.exposed.close();
26
- }
27
- });
14
+ queue.forEach((item) => {
15
+ if (item.$.uid !== comp.$.uid) {
16
+ item.$.exposed.close()
17
+ }
18
+ })
28
19
  }
29
20
 
30
21
  export function closeOutside() {
31
- queue.forEach((item) => {
32
- item.$.exposed.close();
33
- });
22
+ queue.forEach((item) => {
23
+ item.$.exposed.close()
24
+ })
34
25
  }
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, PropType } from 'vue'
1
+ import type { CSSProperties } from 'vue'
2
2
 
3
3
  export interface SwipeActionOptionsVo {
4
4
  text: string
@@ -15,43 +15,6 @@ export type SwipeActionBeforeClose = (
15
15
  position: SwipeActionPosition
16
16
  ) => void
17
17
 
18
- export default interface SwipeActionProps {
19
- /**
20
- * @description 滑动按钮的状态,使用v-model进行双向绑定。
21
- * 选值为:'left'(左滑)、'close'(关闭状态)、'right'(右滑)。
22
- * */
23
- modelValue?: SwipeActionStatus
24
- /**
25
- * @description 是否禁用滑动操作
26
- * */
27
- disabled?: boolean
28
- /**
29
- * @description 是否自动关闭其他swipe按钮组(默认 true )
30
- * */
31
- autoClose?: boolean
32
- /**
33
- * @description 显示底部边框
34
- * */
35
- borderBottom?: boolean
36
- /**
37
- * @description 右侧按钮内容
38
- * */
39
- options?: SwipeActionOptionsVo[]
40
- /**
41
- * @description 动画过渡时间,单位ms(默认 350 )
42
- * */
43
- duration?: number
44
- /**
45
- * @description 在关闭滑动按钮前调用的钩子函数
46
- * @desc 可以在此函数中执行一些关闭前的操作,如确认提示等。
47
- * */
48
- beforeClose?: funtion | PropType<SwipeActionBeforeClose>
49
- /**
50
- * @description 定义需要用到的外部样式
51
- * */
52
- customStyle?: CSSProperties
53
- }
54
-
55
18
  export interface ISwipeActionEmits {
56
19
  /** 当滑动按钮打开时,点击整个滑动操作容器触发 click 事件 */
57
20
  (e: 'click', value: SwipeActionPosition): void
@@ -1,104 +1,3 @@
1
- import type { CSSProperties } from 'vue'
2
-
3
- export default interface HySwiperProps {
4
- /**
5
- * @description 轮播图数据
6
- * */
7
- list: (string | Record<string, unknown>)[]
8
- /**
9
- * @description list数组中指定对象的目标属性名(默认 'url' )
10
- * */
11
- keyName?: string
12
- /**
13
- * @description 是否显示面板指示器(默认 false )
14
- * */
15
- indicator?: boolean
16
- /**
17
- * @description 指示器非激活颜色(默认 '#FFFFFF' )
18
- * */
19
- indicatorActiveColor?: string
20
- /**
21
- * @description 指示器的激活颜色(默认 'rgba(255, 255, 255, 0.35)' )
22
- * */
23
- indicatorInactiveColor?: string
24
- /**
25
- * @description 指示器样式,可通过bottom,left,right进行定位
26
- * */
27
- indicatorStyle?: CSSProperties
28
- /**
29
- * @description 指示器模式(默认 'line' )
30
- * */
31
- indicatorMode?: HyApp.SwiperIndicatorModeType
32
- /**
33
- * @description 是否自动切换(默认 true )
34
- * */
35
- autoplay?: boolean
36
- /**
37
- * @description 当前所在滑块的 index(默认 0 )
38
- * */
39
- current?: number | string
40
- /**
41
- * @description 当前所在滑块的 item-id ,不能与 current 被同时指定
42
- * */
43
- currentItemId?: string
44
- /**
45
- * @description 滑块自动切换时间间隔(ms)(默认 3000 )
46
- * */
47
- interval?: number
48
- /**
49
- * @description 滑块切换过程所需时间(ms)(默认 300 )
50
- * */
51
- duration?: number
52
- /**
53
- * @description 播放到末尾后是否重新回到开头(默认 false )
54
- * */
55
- circular?: boolean
56
- /**
57
- * @description 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持(默认 0 )
58
- * */
59
- previousMargin?: number | string
60
- /**
61
- * @description 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持(默认 0 )
62
- * */
63
- nextMargin?: number | string
64
- /**
65
- * @description 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持(默认 false )
66
- * */
67
- acceleration?: boolean
68
- /**
69
- * @description 同时显示的滑块数量,nvue、支付宝小程序不支持(默认 1 )
70
- * */
71
- displayMultipleItems?: number
72
- /**
73
- * @description 指定swiper切换缓动动画类型, 只对微信小程序有效(默认 'default' )
74
- * */
75
- easingFunction?: string
76
- /**
77
- * @description 图片的裁剪模式(默认 'aspectFill' )
78
- * */
79
- imgMode?: HyApp.ImageModeVo
80
- /**
81
- * @description 组件高度(默认 130 )
82
- * */
83
- height?: number
84
- /**
85
- * @description 背景颜色(默认 '#f3f4f6' )
86
- * */
87
- bgColor?: string
88
- /**
89
- * @description 组件圆角,数值或带单位的字符串(默认 4 )
90
- * */
91
- radius?: number | string
92
- /**
93
- * @description 是否加载中(默认 false )
94
- * */
95
- loading?: boolean
96
- /**
97
- * @description 是否显示标题,要求数组对象中有title属性(默认 false )
98
- * */
99
- showTitle?: boolean
100
- }
101
-
102
1
  export interface SwiperList {
103
2
  [key: string]: any
104
3
  /** 线上地址 */
@@ -1,65 +1,3 @@
1
- import type { CSSProperties } from 'vue'
2
- import type IconProps from '../hy-icon/typing'
3
-
4
- export default interface HySwitchProps {
5
- /**
6
- * @description 通过v-model双向绑定的值 (默认 false )
7
- * */
8
- modelValue: boolean | string | number
9
- /**
10
- * @description 是否处于加载中(默认 false )
11
- * */
12
- loading?: boolean
13
- /**
14
- * @description 是否禁用(默认 false )
15
- * */
16
- disabled?: boolean
17
- /**
18
- * @description 开关尺寸,单位px (默认 25 )
19
- * */
20
- size?: HyApp.SizeType | string | number
21
- /**
22
- * @description 打开时的背景色 (默认 '#2979ff' )
23
- * */
24
- activeColor?: string
25
- /**
26
- * @description 关闭时的背景色 (默认 '#ffffff' )
27
- * */
28
- inactiveColor?: string
29
- /**
30
- * @description 打开选择器时通过change事件发出的值 (默认 true )
31
- * */
32
- activeValue?: boolean | string | number
33
- /**
34
- * @description 关闭选择器时通过change事件发出的值 (默认 false )
35
- * */
36
- inactiveValue?: boolean | string | number
37
- /**
38
- * @description 打开选择器时图标
39
- * */
40
- activeIcon?: string
41
- /**
42
- * @description 关闭选择器时图标
43
- * */
44
- inactiveIcon?: string
45
- /**
46
- * @description 图标
47
- * */
48
- icon?: IconProps
49
- /**
50
- * @description 是否开启异步变更,开启后需要手动控制输入值 (默认 false )
51
- * */
52
- asyncChange?: boolean
53
- /**
54
- * @description 圆点与外边框的距离 (默认 0 )
55
- * */
56
- space?: number
57
- /**
58
- * @description 定义需要用到的外部样式
59
- * */
60
- customStyle?: CSSProperties
61
- }
62
-
63
1
  export type SwitchValue = boolean | number | string
64
2
 
65
3
  export interface ISwitchEmits {
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <view class="hy-tabbar" :style="tabBarStyle">
3
+ <view v-if="placeholder" class="hy-tabbar--placeholder"></view>
4
+
5
+ <view class="hy-tabbar--box" :style="{ background: bgColor }">
6
+ <view class="hy-tabbar--container">
7
+ <view
8
+ :class="[
9
+ 'hy-tabbar--container__item',
10
+ 'list',
11
+ current === i ? 'is-active' : ''
12
+ ]"
13
+ v-for="(item, i) in list"
14
+ :key="i"
15
+ ref="itemRef"
16
+ @click="checkItem(i)"
17
+ >
18
+ <view class="hy-tabbar--container__item--bar">
19
+ <view class="icon">
20
+ <hy-badge
21
+ :value="item?.badge"
22
+ absolute
23
+ :offset="[-13, 25]"
24
+ :max="badgeProps?.max"
25
+ :is-dot="badgeProps?.isDot"
26
+ :inverted="badgeProps?.inverted"
27
+ :bg-color="badgeProps?.bgColor"
28
+ :type="badgeProps?.type"
29
+ :number-type="badgeProps?.numberType"
30
+ :shape="badgeProps?.shape"
31
+ :show-zero="badgeProps?.showZero"
32
+ :show="!!item?.badge"
33
+ ></hy-badge>
34
+ <!-- 图标插槽 -->
35
+ <slot v-if="$slots.icon" name="icon"></slot>
36
+ <hy-icon v-else :name="item.icon" :color="color" size="25"></hy-icon>
37
+ </view>
38
+ <text class="text" :style="[{ color: color }]">{{ item.name }}</text>
39
+ <text class="circle"></text>
40
+ </view>
41
+ </view>
42
+ <view
43
+ class="hy-tabbar--indicator"
44
+ :style="{
45
+ '--num': `translateX(${rectList[current]?.left}px)`,
46
+ background: activeColor
47
+ }"
48
+ ></view>
49
+ </view>
50
+ </view>
51
+ </view>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ export default {
56
+ name: 'hy-tabbar',
57
+ options: {
58
+ addGlobalClass: true,
59
+ virtualHost: true,
60
+ styleIsolation: 'shared'
61
+ }
62
+ }
63
+ </script>
64
+
65
+ <script setup lang="ts">
66
+ import { computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'
67
+ import tabBarProps from './props'
68
+ import type { ITabBarEmits } from './typing'
69
+
70
+ // 组件
71
+ import HyIcon from '../hy-icon/hy-icon.vue'
72
+ import HyBadge from '../hy-badge/hy-badge.vue'
73
+ import { getRect } from '@/package'
74
+
75
+ /**
76
+ * 底部导航栏,用于在不同页面之间进行切换。
77
+ * @displayName hy-tabbar
78
+ */
79
+ defineOptions({})
80
+
81
+ const props = defineProps(tabBarProps)
82
+ const emit = defineEmits<ITabBarEmits>()
83
+
84
+ const instance = getCurrentInstance()
85
+ const rectList = ref<UniNamespace.NodeInfo[]>([])
86
+ const baseBackgroundColor = props.baseBgColor ? props.baseBgColor : 'var(--hy-background)'
87
+ const current = ref<number>(props.modelValue)
88
+ watch(
89
+ () => props.modelValue,
90
+ (newVal) => {
91
+ current.value = newVal
92
+ }
93
+ )
94
+
95
+ onMounted(() => {
96
+ nextTick(() => {
97
+ getRect('.list', true, instance).then((res) => {
98
+ console.log(res, current.value)
99
+ rectList.value = res
100
+ })
101
+ })
102
+ })
103
+
104
+ // tabbar属性值
105
+ const tabBarStyle = computed(() => {
106
+ const style = {
107
+ position: props.fixed ? 'fixed' : '',
108
+ zIndex: props.zIndex
109
+ }
110
+
111
+ return Object.assign(style, props.customStyle)
112
+ })
113
+
114
+ const checkItem = (index: number) => {
115
+ if (current.value !== index) {
116
+ current.value = index
117
+ emit('change', index)
118
+ emit('update:modelValue', index)
119
+ }
120
+ }
121
+ </script>
122
+
123
+ <style lang="scss" scoped>
124
+ @import './index.scss';
125
+ .hy-tabbar {
126
+ background: v-bind(baseBackgroundColor);
127
+ &--indicator {
128
+ border: 5px solid v-bind(baseBackgroundColor);
129
+ &::before {
130
+ box-shadow: 1px -15rpx 0 v-bind(baseBackgroundColor);
131
+ }
132
+ &::after {
133
+ box-shadow: -1px -15rpx 0 v-bind(baseBackgroundColor);
134
+ }
135
+ }
136
+ }
137
+ </style>