hy-app 0.5.3 → 0.5.4

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 (46) hide show
  1. package/components/hy-avatar/hy-avatar.vue +4 -3
  2. package/components/hy-badge/hy-badge.vue +3 -3
  3. package/components/hy-badge/index.scss +0 -1
  4. package/components/hy-badge/props.ts +6 -1
  5. package/components/hy-coupon/index.scss +7 -2
  6. package/components/hy-coupon/props.ts +7 -4
  7. package/components/hy-coupon/typing.d.ts +1 -1
  8. package/components/hy-datetime-picker/props.ts +1 -3
  9. package/components/hy-folding-panel/props.ts +1 -1
  10. package/components/hy-folding-panel/typing.d.ts +0 -38
  11. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -3
  12. package/components/hy-folding-panel-item/typing.d.ts +14 -0
  13. package/components/hy-icon/hy-icon.vue +3 -8
  14. package/components/hy-list/props.ts +1 -1
  15. package/components/hy-notice-bar/typing.d.ts +2 -0
  16. package/components/hy-popup/hy-popup.vue +0 -1
  17. package/components/hy-qrcode/hy-qrcode.vue +70 -4
  18. package/components/hy-qrcode/index.scss +3 -4
  19. package/components/hy-qrcode/qrcode.js +138 -0
  20. package/components/hy-signature/hy-signature.vue +25 -22
  21. package/components/hy-signature/index.scss +0 -4
  22. package/components/hy-tabbar/hy-tabbar.vue +137 -0
  23. package/components/{hy-tabBar → hy-tabbar}/index.scss +30 -30
  24. package/components/hy-tabbar/props.ts +59 -0
  25. package/components/hy-tabbar/typing.d.ts +61 -0
  26. package/components/hy-tabbar-group/README.md +326 -0
  27. package/components/hy-tabbar-group/hy-tabbar-group.vue +87 -0
  28. package/components/hy-tabbar-group/index.scss +57 -0
  29. package/components/hy-tabbar-group/props.ts +78 -0
  30. package/components/hy-tabbar-group/typing.ts +16 -0
  31. package/components/hy-tabbar-item/hy-tabbar-item.vue +103 -0
  32. package/components/hy-tabbar-item/index.scss +43 -0
  33. package/components/hy-tabbar-item/props.ts +24 -0
  34. package/components/hy-tabbar-item/typing.ts +22 -0
  35. package/components/hy-tag/props.ts +8 -2
  36. package/components/hy-text/props.ts +8 -2
  37. package/components/hy-textarea/props.ts +4 -1
  38. package/components/hy-tooltip/props.ts +1 -3
  39. package/components/hy-upload/props.ts +1 -1
  40. package/components/index.ts +177 -177
  41. package/global.d.ts +87 -85
  42. package/package.json +2 -2
  43. package/web-types.json +1 -1
  44. package/components/hy-tabBar/hy-tabBar.vue +0 -109
  45. package/components/hy-tabBar/props.ts +0 -13
  46. package/components/hy-tabBar/typing.d.ts +0 -54
@@ -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>
@@ -1,27 +1,26 @@
1
1
  @use "../../libs/css/theme" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- @include b(tabBar) {
5
- height: 135rpx;
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: 135rpx;
11
- position: relative;
11
+ height: 137rpx;
12
12
  bottom: 0;
13
13
  }
14
14
 
15
15
  @include m(box) {
16
- margin-top: 15rpx;
17
- position: relative;
18
- width: 100vw;
19
- height: 120rpx;
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-between;
32
+ justify-content: space-around;
34
33
  align-items: center;
35
34
  padding: 0 20rpx;
36
35
  &__item {
37
36
  position: relative;
38
- width: 100rpx;
39
- height: 70rpx;
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-tabBar--indicator {
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-tabBar--indicator {
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-tabBar--indicator {
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-tabBar--indicator {
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-tabBar--indicator {
58
+ &:nth-child(5).is-active ~ .hy-tabbar--indicator {
60
59
  transform: var(--num);
61
60
  }
62
61
  /* #endif */
63
62
 
64
- &--bar {
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: 75rpx;
95
- height: 75rpx;
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(tabBar--container__item--bar) {
104
+ @include b(tabbar--container__item--bar) {
105
105
  .icon {
106
- transform: translate(2rpx, -56rpx);
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(2rpx, -56rpx) scale(1);
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: -59%;
131
- left: 30rpx;
132
- width: 100rpx;
133
- height: 100rpx;
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;
@@ -159,7 +159,7 @@
159
159
  /* #endif */
160
160
  position: absolute;
161
161
  top: 58%;
162
- right: -49rpx;
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,61 @@
1
+ import type HyBadgeProps from '../hy-badge/typing'
2
+
3
+ export interface TabListVo {
4
+ /**
5
+ * @description 标题
6
+ * */
7
+ name: string
8
+ /**
9
+ * @description icon图标或者图片
10
+ * */
11
+ icon: string
12
+ /**
13
+ * @description 徽标值
14
+ * */
15
+ badge?: number
16
+ }
17
+
18
+ export interface HyTabBarProps {
19
+ /**
20
+ * @description tab当前值
21
+ * */
22
+ modelValue: number
23
+ /**
24
+ * @description 导航栏值
25
+ * {
26
+ * name: 中文名,
27
+ * icon: uview-plus里面的矢量图标库
28
+ * }
29
+ * */
30
+ list: TabListVo[]
31
+ /**
32
+ * @description 文字颜色
33
+ * */
34
+ color?: string
35
+ /**
36
+ * @description 底部导航栏底部背景颜色(颜色设置必须要和页面背景颜色一样,才有重合感觉)
37
+ * 支持渐变色--linear-gradient(155deg, #192b6e, #a6307c)
38
+ * */
39
+ baseBgColor?: string
40
+ /**
41
+ * @description 底部导航栏背景颜色
42
+ * 支持渐变色--linear-gradient(155deg, #192b6e, #a6307c)
43
+ * */
44
+ barBgColor?: string
45
+ /**
46
+ * @description 点击突出按钮的背景颜色
47
+ * 支持渐变色--linear-gradient(0deg, #ffa576,#0951eb)
48
+ * */
49
+ activeColor?: string
50
+ /**
51
+ * @description 徽标属性集合
52
+ * */
53
+ badge?: Partial<HyBadgeProps>
54
+ }
55
+
56
+ export interface ITabBarEmits {
57
+ /** 更新选中索引 */
58
+ (e: 'update:modelValue', index: number): void
59
+ /** 变化事件 */
60
+ (e: 'change', index: number): void
61
+ }