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.
- package/components/hy-action-sheet/typing.d.ts +1 -63
- package/components/hy-address-picker/hy-address-picker.vue +7 -6
- package/components/hy-address-picker/typing.d.ts +0 -84
- package/components/hy-avatar/hy-avatar.vue +4 -3
- package/components/hy-avatar/typing.d.ts +0 -66
- package/components/hy-back-top/typing.d.ts +0 -47
- package/components/hy-badge/hy-badge.vue +3 -3
- package/components/hy-badge/index.scss +0 -1
- package/components/hy-badge/props.ts +6 -1
- package/components/hy-badge/typing.d.ts +0 -62
- package/components/hy-button/typing.d.ts +28 -162
- package/components/hy-calendar/hy-calendar.vue +2 -2
- package/components/hy-calendar/typing.d.ts +0 -128
- package/components/hy-card/hy-card.vue +12 -12
- package/components/hy-card/index.scss +17 -5
- package/components/hy-card/props.ts +1 -2
- package/components/hy-card/typing.d.ts +1 -114
- package/components/hy-cell/props.ts +1 -1
- package/components/hy-cell/typing.d.ts +0 -55
- package/components/hy-check-button/typing.d.ts +0 -43
- package/components/hy-checkbox/typing.d.ts +1 -73
- package/components/hy-checkbox-group/typing.d.ts +0 -65
- package/components/hy-code-input/typing.d.ts +0 -70
- package/components/hy-count-down/typing.d.ts +1 -20
- package/components/hy-count-to/typing.d.ts +0 -47
- package/components/hy-coupon/index.scss +7 -2
- package/components/hy-coupon/props.ts +7 -4
- package/components/hy-coupon/typing.d.ts +1 -134
- package/components/hy-datetime-picker/props.ts +1 -3
- package/components/hy-datetime-picker/typing.d.ts +0 -119
- package/components/hy-dropdown-item/typing.d.ts +12 -31
- package/components/hy-empty/typing.d.ts +1 -59
- package/components/hy-float-button/typing.d.ts +24 -113
- package/components/hy-folding-panel/props.ts +1 -1
- package/components/hy-folding-panel/typing.d.ts +0 -38
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -3
- package/components/hy-folding-panel-item/typing.d.ts +14 -0
- package/components/hy-form/typing.d.ts +0 -27
- package/components/hy-form-item/hy-form-item.vue +7 -5
- package/components/hy-form-item/typing.d.ts +0 -19
- package/components/hy-grid/typing.d.ts +0 -43
- package/components/hy-icon/hy-icon.vue +3 -8
- package/components/hy-icon/typing.d.ts +0 -86
- package/components/hy-image/typing.d.ts +0 -80
- package/components/hy-input/typing.d.ts +0 -149
- package/components/hy-list/props.ts +1 -1
- package/components/hy-list/typing.d.ts +0 -51
- package/components/hy-menu/typing.d.ts +0 -35
- package/components/hy-modal/typing.d.ts +9 -84
- package/components/hy-navbar/typing.d.ts +0 -81
- package/components/hy-notice-bar/typing.d.ts +2 -65
- package/components/hy-number-step/typing.d.ts +0 -110
- package/components/hy-overlay/typing.d.ts +2 -27
- package/components/hy-pagination/typing.d.ts +6 -49
- package/components/hy-picker/typing.d.ts +27 -124
- package/components/hy-popover/typing.d.ts +25 -66
- package/components/hy-popup/hy-popup.vue +0 -1
- package/components/hy-popup/typing.d.ts +8 -77
- package/components/hy-price/typing.d.ts +0 -41
- package/components/hy-qrcode/hy-qrcode.vue +67 -2
- package/components/hy-qrcode/index.scss +3 -4
- package/components/hy-qrcode/typing.d.ts +0 -66
- package/components/hy-radio/typing.d.ts +1 -86
- package/components/hy-rate/typing.d.ts +0 -62
- package/components/hy-read-more/typing.d.ts +4 -49
- package/components/hy-scroll-list/typing.d.ts +4 -33
- package/components/hy-search/typing.d.ts +19 -120
- package/components/hy-signature/hy-signature.vue +25 -22
- package/components/hy-signature/index.scss +0 -4
- package/components/hy-signature/typing.d.ts +0 -101
- package/components/hy-slider/typing.d.ts +8 -77
- package/components/hy-steps/typing.d.ts +16 -60
- package/components/hy-submit-bar/typing.d.ts +0 -72
- package/components/hy-subsection/typing.d.ts +0 -49
- package/components/hy-swipe-action/index.ts +13 -22
- package/components/hy-swipe-action/typing.d.ts +1 -38
- package/components/hy-swiper/typing.d.ts +0 -101
- package/components/hy-switch/typing.d.ts +0 -62
- package/components/hy-tabbar/hy-tabbar.vue +137 -0
- package/components/{hy-tabBar → hy-tabbar}/index.scss +31 -31
- package/components/hy-tabbar/props.ts +59 -0
- package/components/hy-tabbar/typing.d.ts +21 -0
- package/components/hy-tabbar-group/hy-tabbar-group.vue +87 -0
- package/components/hy-tabbar-group/index.scss +57 -0
- package/components/hy-tabbar-group/props.ts +78 -0
- package/components/hy-tabbar-group/typing.ts +16 -0
- package/components/hy-tabbar-item/hy-tabbar-item.vue +103 -0
- package/components/hy-tabbar-item/index.scss +43 -0
- package/components/hy-tabbar-item/props.ts +24 -0
- package/components/hy-tabbar-item/typing.ts +10 -0
- package/components/hy-tabs/typing.d.ts +25 -92
- package/components/hy-tag/props.ts +8 -2
- package/components/hy-tag/typing.d.ts +9 -78
- package/components/hy-text/props.ts +8 -2
- package/components/hy-text/typing.d.ts +3 -100
- package/components/hy-textarea/props.ts +4 -1
- package/components/hy-textarea/typing.d.ts +0 -27
- package/components/hy-tooltip/props.ts +1 -4
- package/components/hy-tooltip/typing.d.ts +2 -55
- package/components/hy-transition/typing.d.ts +14 -43
- package/components/hy-upload/props.ts +1 -1
- package/components/hy-upload/typing.d.ts +56 -164
- package/components/hy-warn/typing.d.ts +4 -45
- package/components/index.ts +177 -177
- package/global.d.ts +87 -85
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-config-provider/typing.d.ts +0 -24
- package/components/hy-divider/typing.d.ts +0 -64
- package/components/hy-dropdown/typing.d.ts +0 -48
- package/components/hy-form-group/typing.d.ts +0 -0
- package/components/hy-line/typing.d.ts +0 -32
- package/components/hy-line-progress/typing.d.ts +0 -32
- package/components/hy-loading/typing.d.ts +0 -52
- package/components/hy-notify/typing.d.ts +0 -48
- package/components/hy-status-bar/typing.d.ts +0 -12
- package/components/hy-tabBar/hy-tabBar.vue +0 -109
- package/components/hy-tabBar/props.ts +0 -13
- package/components/hy-tabBar/typing.d.ts +0 -54
- package/components/hy-waterfall/typing.d.ts +0 -14
- package/components/hy-watermark/typing.d.ts +0 -76
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
@use "../../libs/css/theme" as *;
|
|
2
2
|
@use "../../libs/css/mixin.scss" as *;
|
|
3
3
|
|
|
4
|
-
@include b(
|
|
5
|
-
height:
|
|
6
|
-
z-index: 999;
|
|
7
|
-
position: fixed;
|
|
4
|
+
@include b(tabbar) {
|
|
5
|
+
height: 70px;
|
|
8
6
|
bottom: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
position: relative;
|
|
9
10
|
@include m(placeholder) {
|
|
10
|
-
height:
|
|
11
|
-
position: relative;
|
|
11
|
+
height: 137rpx;
|
|
12
12
|
bottom: 0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
@include m(box) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
width:
|
|
19
|
-
height:
|
|
16
|
+
position: absolute;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 60px;
|
|
20
20
|
display: flex;
|
|
21
21
|
justify-content: center;
|
|
22
22
|
align-items: center;
|
|
23
23
|
border-radius: 15rpx 15rpx 0 0;
|
|
24
|
-
padding: 0 20rpx;
|
|
25
24
|
/* #ifndef APP-PLUS-NVUE */
|
|
26
25
|
box-sizing: border-box;
|
|
27
26
|
/* #endif */
|
|
@@ -30,38 +29,38 @@
|
|
|
30
29
|
@include m(container) {
|
|
31
30
|
width: 100%;
|
|
32
31
|
display: flex;
|
|
33
|
-
justify-content: space-
|
|
32
|
+
justify-content: space-around;
|
|
34
33
|
align-items: center;
|
|
35
34
|
padding: 0 20rpx;
|
|
36
35
|
&__item {
|
|
37
36
|
position: relative;
|
|
38
|
-
width:
|
|
39
|
-
height:
|
|
37
|
+
width: 60px;
|
|
38
|
+
height: 100%;
|
|
40
39
|
z-index: 1;
|
|
41
40
|
|
|
42
41
|
/* #ifndef APP-PLUS-NVUE */
|
|
43
|
-
&:nth-child(1).is-active ~ .hy-
|
|
42
|
+
&:nth-child(1).is-active ~ .hy-tabbar--indicator {
|
|
44
43
|
transform: var(--num);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
&:nth-child(2).is-active ~ .hy-
|
|
46
|
+
&:nth-child(2).is-active ~ .hy-tabbar--indicator {
|
|
48
47
|
transform: var(--num);
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
&:nth-child(3).is-active ~ .hy-
|
|
50
|
+
&:nth-child(3).is-active ~ .hy-tabbar--indicator {
|
|
52
51
|
transform: var(--num);
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
&:nth-child(4).is-active ~ .hy-
|
|
54
|
+
&:nth-child(4).is-active ~ .hy-tabbar--indicator {
|
|
56
55
|
transform: var(--num);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
&:nth-child(5).is-active ~ .hy-
|
|
58
|
+
&:nth-child(5).is-active ~ .hy-tabbar--indicator {
|
|
60
59
|
transform: var(--num);
|
|
61
60
|
}
|
|
62
61
|
/* #endif */
|
|
63
62
|
|
|
64
|
-
|
|
63
|
+
@include m(bar) {
|
|
65
64
|
position: relative;
|
|
66
65
|
display: flex;
|
|
67
66
|
justify-content: center;
|
|
@@ -91,19 +90,20 @@
|
|
|
91
90
|
/* #ifndef APP-PLUS-NVUE */
|
|
92
91
|
display: block;
|
|
93
92
|
/* #endif */
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
93
|
+
width: 40px;
|
|
94
|
+
height: 40px;
|
|
96
95
|
background: transparent;
|
|
97
96
|
border-radius: 50%;
|
|
98
97
|
border: 3rpx solid #fff;
|
|
99
98
|
transform: translateY(-70rpx) scale(0);
|
|
99
|
+
z-index: -1;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
@include is(active) {
|
|
104
|
-
@include b(
|
|
104
|
+
@include b(tabbar--container__item--bar) {
|
|
105
105
|
.icon {
|
|
106
|
-
transform: translate(
|
|
106
|
+
transform: translate(0, -36px);
|
|
107
107
|
:deep(.hy-icon) {
|
|
108
108
|
color: #FFFFFF;
|
|
109
109
|
}
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
transition: 0.5s;
|
|
119
119
|
/* #endif */
|
|
120
120
|
transition-delay: 0.5s;
|
|
121
|
-
transform: translate(
|
|
121
|
+
transform: translate(-1px, -36px) scale(1);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -127,10 +127,10 @@
|
|
|
127
127
|
|
|
128
128
|
@include m(indicator) {
|
|
129
129
|
position: absolute;
|
|
130
|
-
top: -
|
|
131
|
-
left:
|
|
132
|
-
width:
|
|
133
|
-
height:
|
|
130
|
+
top: -36px;
|
|
131
|
+
left: 0;
|
|
132
|
+
width: 50px;
|
|
133
|
+
height: 50px;
|
|
134
134
|
border-radius: 50%;
|
|
135
135
|
display: flex;
|
|
136
136
|
justify-content: center;
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
/* #endif */
|
|
147
147
|
position: absolute;
|
|
148
148
|
top: 59%;
|
|
149
|
-
left: -
|
|
149
|
+
left: -46rpx;
|
|
150
150
|
width: 50rpx;
|
|
151
151
|
height: 40rpx;
|
|
152
152
|
background: transparent;
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
/* #endif */
|
|
160
160
|
position: absolute;
|
|
161
161
|
top: 58%;
|
|
162
|
-
right: -
|
|
162
|
+
right: -46rpx;
|
|
163
163
|
width: 50rpx;
|
|
164
164
|
height: 40rpx;
|
|
165
165
|
background: transparent;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
+
import type HyBadgeProps from '../hy-badge/typing'
|
|
3
|
+
|
|
4
|
+
const tabBarProps = {
|
|
5
|
+
/** 选中项的索引值 */
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: Number,
|
|
8
|
+
default: 0
|
|
9
|
+
},
|
|
10
|
+
/** 导航栏数据集合 */
|
|
11
|
+
list: {
|
|
12
|
+
type: Array,
|
|
13
|
+
default: () => []
|
|
14
|
+
},
|
|
15
|
+
/** 是否固定在底部 */
|
|
16
|
+
fixed: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: true
|
|
19
|
+
},
|
|
20
|
+
/** 是否显示占位元素 */
|
|
21
|
+
placeholder: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
zIndex: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 10086
|
|
28
|
+
},
|
|
29
|
+
/** 图标和字体颜色 */
|
|
30
|
+
color: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
/** 轨道颜色 */
|
|
35
|
+
baseBgColor: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: ''
|
|
38
|
+
},
|
|
39
|
+
/** 背景颜色 */
|
|
40
|
+
bgColor: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: ''
|
|
43
|
+
},
|
|
44
|
+
/** 激活圆形背景颜色 */
|
|
45
|
+
activeColor: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: ''
|
|
48
|
+
},
|
|
49
|
+
/** 徽标部分属性 */
|
|
50
|
+
badgeProps: {
|
|
51
|
+
type: Object as PropType<HyBadgeProps>
|
|
52
|
+
},
|
|
53
|
+
/** 定义需要用到的外部样式 */
|
|
54
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
55
|
+
/** 自定义外部类名 */
|
|
56
|
+
customClass: String
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default tabBarProps
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TabListVo {
|
|
2
|
+
/**
|
|
3
|
+
* @description 标题
|
|
4
|
+
* */
|
|
5
|
+
name: string
|
|
6
|
+
/**
|
|
7
|
+
* @description icon图标或者图片
|
|
8
|
+
* */
|
|
9
|
+
icon: string
|
|
10
|
+
/**
|
|
11
|
+
* @description 徽标值
|
|
12
|
+
* */
|
|
13
|
+
badge?: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ITabBarEmits {
|
|
17
|
+
/** 更新选中索引 */
|
|
18
|
+
(e: 'update:modelValue', index: number): void
|
|
19
|
+
/** 变化事件 */
|
|
20
|
+
(e: 'change', index: number): void
|
|
21
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="{
|
|
4
|
+
'hy-tabbar-group__placeholder':
|
|
5
|
+
fixed && placeholder && safeAreaInsetBottom && shape === 'round'
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
8
|
+
<view :class="rootClass" :style="rootStyle">
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
export default {
|
|
16
|
+
name: 'hy-tabbar-group',
|
|
17
|
+
options: {
|
|
18
|
+
addGlobalClass: true,
|
|
19
|
+
virtualHost: true,
|
|
20
|
+
styleIsolation: 'shared'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
import { computed, provide, toRefs, type CSSProperties, ref, onUnmounted } from 'vue'
|
|
27
|
+
import tabbarGroupProps from './props'
|
|
28
|
+
import type { ITabBarGroupEmits } from './typing'
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 底部导航栏,用于在不同页面之间进行切换。
|
|
32
|
+
* @displayName hy-tabbar-group
|
|
33
|
+
*/
|
|
34
|
+
defineOptions({})
|
|
35
|
+
|
|
36
|
+
const props = defineProps(tabbarGroupProps)
|
|
37
|
+
const emit = defineEmits<ITabBarGroupEmits>()
|
|
38
|
+
|
|
39
|
+
const index = ref(0) // 递增用
|
|
40
|
+
const getIndex = () => {
|
|
41
|
+
return index.value++
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
provide('hy-tabbar', {
|
|
45
|
+
...toRefs(props),
|
|
46
|
+
setChange,
|
|
47
|
+
getIndex
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// 父属性值
|
|
51
|
+
const rootStyle = computed(() => {
|
|
52
|
+
const style: CSSProperties = {
|
|
53
|
+
background: props.bgColor,
|
|
54
|
+
zIndex: props.zIndex
|
|
55
|
+
}
|
|
56
|
+
return Object.assign(style, props.customStyle)
|
|
57
|
+
})
|
|
58
|
+
// 父类名
|
|
59
|
+
const rootClass = computed(() => {
|
|
60
|
+
return [
|
|
61
|
+
'hy-tabbar-group',
|
|
62
|
+
`hy-tabbar-group--${props.shape}`,
|
|
63
|
+
props.customClass,
|
|
64
|
+
props.fixed && 'is-fixed',
|
|
65
|
+
props.safeAreaInsetBottom && 'is-safe',
|
|
66
|
+
props.border && 'is-border'
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
onUnmounted(() => {
|
|
71
|
+
index.value = 0
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 子项状态变更
|
|
76
|
+
* @param index 子项
|
|
77
|
+
*/
|
|
78
|
+
function setChange(index: string | number) {
|
|
79
|
+
emit('update:modelValue', index)
|
|
80
|
+
emit('change', {
|
|
81
|
+
value: index
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
<style lang="scss" scoped>
|
|
86
|
+
@import './index.scss';
|
|
87
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@use "../../libs/css/theme" as *;
|
|
2
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
3
|
+
|
|
4
|
+
@include b(tabbar-group) {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
flex-wrap: nowrap;
|
|
8
|
+
position: relative;
|
|
9
|
+
background: $hy-background--container;
|
|
10
|
+
height: 100rpx;
|
|
11
|
+
|
|
12
|
+
@include e(placeholder) {
|
|
13
|
+
box-sizing: content-box;
|
|
14
|
+
padding-bottom: constant(safe-area-inset-bottom);
|
|
15
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
16
|
+
height: 100rpx;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include m(circle) {
|
|
20
|
+
margin-left: $hy-border-margin-padding-lg;
|
|
21
|
+
margin-right: $hy-border-margin-padding-lg;
|
|
22
|
+
border-radius: $hy-border-radius-semicircle;
|
|
23
|
+
box-shadow: $hy-box-shadow;
|
|
24
|
+
|
|
25
|
+
@include is(fixed) {
|
|
26
|
+
@include is(safe) {
|
|
27
|
+
bottom: constant(safe-area-inset-bottom);
|
|
28
|
+
bottom: env(safe-area-inset-bottom);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include m(square) {
|
|
35
|
+
|
|
36
|
+
@include is(fixed) {
|
|
37
|
+
@include is(safe) {
|
|
38
|
+
box-sizing: content-box;
|
|
39
|
+
padding-bottom: constant(safe-area-inset-bottom);
|
|
40
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@include is(border) {
|
|
46
|
+
border-top: $hy-border-line;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include is(fixed) {
|
|
51
|
+
position: fixed;
|
|
52
|
+
left: 0;
|
|
53
|
+
bottom: 0;
|
|
54
|
+
right: 0;
|
|
55
|
+
z-index: 500;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
+
import type HyBadgeProps from '../hy-badge/typing'
|
|
3
|
+
|
|
4
|
+
const tabbarGroupProps = {
|
|
5
|
+
/** 选中项的索引值 */
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: Number,
|
|
8
|
+
default: 0
|
|
9
|
+
},
|
|
10
|
+
/** 是否固定在底部 */
|
|
11
|
+
fixed: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
/** 是否显示顶部边框 */
|
|
16
|
+
border: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: true
|
|
19
|
+
},
|
|
20
|
+
/** 是否显示占位元素 */
|
|
21
|
+
placeholder: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* 导航栏的形状
|
|
27
|
+
* @values square, circle
|
|
28
|
+
* */
|
|
29
|
+
shape: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'square'
|
|
32
|
+
},
|
|
33
|
+
/** 背景颜色 */
|
|
34
|
+
bgColor: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
38
|
+
/** 激活颜色 */
|
|
39
|
+
activeColor: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
/** 非激活颜色 */
|
|
44
|
+
inactiveColor: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
48
|
+
/** 底部安全区域适配 - 主要用于iPhone X及以上机型 */
|
|
49
|
+
safeAreaInsetBottom: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
/** 图标大小 */
|
|
54
|
+
iconSize: {
|
|
55
|
+
type: [String, Number],
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
/** 文字大小 */
|
|
59
|
+
fontSize: {
|
|
60
|
+
type: [String, Number],
|
|
61
|
+
default: ''
|
|
62
|
+
},
|
|
63
|
+
/** 徽标部分属性 */
|
|
64
|
+
badgeProps: {
|
|
65
|
+
type: Object as PropType<HyBadgeProps>
|
|
66
|
+
},
|
|
67
|
+
/** z-index层级 */
|
|
68
|
+
zIndex: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: 10086
|
|
71
|
+
},
|
|
72
|
+
/** 定义需要用到的外部样式 */
|
|
73
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
74
|
+
/** 自定义外部类名 */
|
|
75
|
+
customClass: String
|
|
76
|
+
} as const
|
|
77
|
+
|
|
78
|
+
export default tabbarGroupProps
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ExtractPropTypes, ToRefs } from 'vue'
|
|
2
|
+
import type tabbarGroupProps from './props'
|
|
3
|
+
|
|
4
|
+
export type TabBarGroupProps = ToRefs<ExtractPropTypes<typeof tabbarGroupProps>>
|
|
5
|
+
|
|
6
|
+
export type ParamType = {
|
|
7
|
+
value: string | number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// ITabBarGroupEmits 接口定义组件的自定义事件
|
|
11
|
+
export interface ITabBarGroupEmits {
|
|
12
|
+
/** 更新选中索引 */
|
|
13
|
+
(e: 'update:modelValue', value: string | number): void
|
|
14
|
+
/** 变化事件 */
|
|
15
|
+
(e: 'change', param: ParamType): void
|
|
16
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hy-tabbar-item" @click="handleClick">
|
|
3
|
+
<view class="hy-tabbar-item__body">
|
|
4
|
+
<hy-badge
|
|
5
|
+
:value="value"
|
|
6
|
+
:show="!!value"
|
|
7
|
+
absolute
|
|
8
|
+
:offset="tabbarConfig?.badgeProps.value?.offset || [-10, 18]"
|
|
9
|
+
:isDot="tabbarConfig?.badgeProps.value?.isDot"
|
|
10
|
+
:max="tabbarConfig?.badgeProps.value?.max"
|
|
11
|
+
:type="tabbarConfig?.badgeProps.value?.type"
|
|
12
|
+
:bgColor="tabbarConfig?.badgeProps.value?.bgColor"
|
|
13
|
+
:color="tabbarConfig?.badgeProps.value?.color"
|
|
14
|
+
:shape="tabbarConfig?.badgeProps.value?.shape"
|
|
15
|
+
:numberType="tabbarConfig?.badgeProps.value?.numberType"
|
|
16
|
+
:inverted="tabbarConfig?.badgeProps.value?.inverted"
|
|
17
|
+
>
|
|
18
|
+
</hy-badge>
|
|
19
|
+
<slot v-if="$slots.icon" name="icon" :active="active"></slot>
|
|
20
|
+
<hy-icon
|
|
21
|
+
v-else
|
|
22
|
+
:name="icon"
|
|
23
|
+
:color="iconColor"
|
|
24
|
+
:size="tabbarConfig?.iconSize?.value"
|
|
25
|
+
:custom-class="`hy-tabbar-item__body-icon ${active ? 'is-active' : 'is-inactive'}`"
|
|
26
|
+
></hy-icon>
|
|
27
|
+
<text
|
|
28
|
+
v-if="title"
|
|
29
|
+
:style="{ color: iconColor, fontSize: tabbarConfig?.fontSize?.value }"
|
|
30
|
+
:class="`hy-tabbar-item__body-title ${active ? 'is-active' : 'is-inactive'}`"
|
|
31
|
+
>
|
|
32
|
+
{{ title }}
|
|
33
|
+
</text>
|
|
34
|
+
</view>
|
|
35
|
+
</view>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
export default {
|
|
40
|
+
name: 'hy-tabbar-item',
|
|
41
|
+
options: {
|
|
42
|
+
addGlobalClass: true,
|
|
43
|
+
virtualHost: true,
|
|
44
|
+
styleIsolation: 'shared'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<script lang="ts" setup>
|
|
50
|
+
import { computed, inject, ref } from 'vue'
|
|
51
|
+
import tabbarItemProps from './props'
|
|
52
|
+
import type { ITabbarConfig } from './typing'
|
|
53
|
+
|
|
54
|
+
// 组件
|
|
55
|
+
import HyBadge from '../hy-badge/hy-badge.vue'
|
|
56
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 底部导航栏,用于在不同页面之间进行切换。
|
|
60
|
+
* @displayName hy-tabbar-item
|
|
61
|
+
*/
|
|
62
|
+
defineOptions({})
|
|
63
|
+
|
|
64
|
+
const props = defineProps(tabbarItemProps)
|
|
65
|
+
|
|
66
|
+
// 尝试从父组件注入配置
|
|
67
|
+
const tabbarConfig = inject<ITabbarConfig>('hy-tabbar')
|
|
68
|
+
// 获取唯一 ID
|
|
69
|
+
const uid = ref<number>(tabbarConfig?.getIndex()!)
|
|
70
|
+
|
|
71
|
+
const iconColor = computed(() => {
|
|
72
|
+
if (tabbarConfig) {
|
|
73
|
+
if (active.value && tabbarConfig.activeColor?.value) {
|
|
74
|
+
return tabbarConfig.activeColor.value
|
|
75
|
+
}
|
|
76
|
+
if (!active.value && tabbarConfig.inactiveColor?.value) {
|
|
77
|
+
return tabbarConfig.inactiveColor.value
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const active = computed(() => {
|
|
83
|
+
const name = props.name || uid.value
|
|
84
|
+
if (tabbarConfig) {
|
|
85
|
+
return tabbarConfig.modelValue.value === name
|
|
86
|
+
} else {
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 点击tabbar选项
|
|
93
|
+
*/
|
|
94
|
+
function handleClick() {
|
|
95
|
+
const index: string | number = props.name || uid.value
|
|
96
|
+
if (tabbarConfig && index !== tabbarConfig?.modelValue?.value) {
|
|
97
|
+
tabbarConfig.setChange(index)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
<style lang="scss" scoped>
|
|
102
|
+
@import './index.scss';
|
|
103
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@use "../../libs/css/theme" as *;
|
|
2
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@include b(tabbar-item) {
|
|
6
|
+
flex: 1;
|
|
7
|
+
text-align: center;
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
height: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
|
|
14
|
+
@include e(body) {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
line-height: 1;
|
|
19
|
+
padding: 0;
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
:deep(){
|
|
23
|
+
@include is(active) {
|
|
24
|
+
color: $hy-primary;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@include is(inactive) {
|
|
28
|
+
color: $hy-text-color--grey;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@include e(body-title) {
|
|
35
|
+
font-size: $hy-font-size-sm;
|
|
36
|
+
line-height: initial;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@include edeep(body-icon) {
|
|
40
|
+
font-size: 40rpx;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const tabBarItemProps = {
|
|
2
|
+
/** 图标 */
|
|
3
|
+
icon: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: ''
|
|
6
|
+
},
|
|
7
|
+
/** 标题 */
|
|
8
|
+
title: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: ''
|
|
11
|
+
},
|
|
12
|
+
/** 唯一标识 */
|
|
13
|
+
name: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
17
|
+
/** 徽标显示值,当为徽标为点时候,必须要value设置true或者有值 */
|
|
18
|
+
value: {
|
|
19
|
+
type: [String, Number, Boolean],
|
|
20
|
+
default: ''
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default tabBarItemProps
|