hy-app 0.2.16 → 0.2.18
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/hy-action-sheet.vue +5 -5
- package/components/hy-action-sheet/index.scss +6 -1
- package/components/hy-address-picker/hy-address-picker.vue +5 -5
- package/components/hy-avatar/hy-avatar.vue +5 -5
- package/components/hy-back-top/hy-back-top.vue +5 -5
- package/components/hy-badge/hy-badge.vue +5 -5
- package/components/hy-button/hy-button.vue +5 -5
- package/components/hy-calendar/hy-calendar.vue +22 -18
- package/components/hy-calendar/typing.d.ts +1 -1
- package/components/hy-card/hy-card.vue +5 -5
- package/components/hy-cell/hy-cell.vue +10 -11
- package/components/hy-check-button/hy-check-button.vue +7 -6
- package/components/hy-checkbox/hy-checkbox.vue +14 -14
- package/components/hy-code-input/hy-code-input.vue +8 -15
- package/components/hy-code-input/index.scss +1 -1
- package/components/hy-config-provider/hy-config-provider.vue +8 -6
- package/components/hy-count-down/hy-count-down.vue +7 -6
- package/components/hy-count-to/hy-count-to.vue +6 -5
- package/components/hy-datetime-picker/hy-datetime-picker.vue +7 -7
- package/components/hy-divider/hy-divider.vue +10 -7
- package/components/hy-dropdown/hy-dropdown.vue +6 -5
- package/components/hy-dropdown-item/hy-dropdown-item.vue +7 -5
- package/components/hy-empty/hy-empty.vue +6 -5
- package/components/hy-float-button/hy-float-button.vue +6 -6
- package/components/hy-folding-panel/hy-folding-panel.vue +6 -5
- package/components/hy-grid/hy-grid.vue +11 -13
- package/components/hy-grid/typing.d.ts +1 -1
- package/components/hy-icon/hy-icon.vue +15 -15
- package/components/hy-image/hy-image.vue +15 -9
- package/components/hy-input/hy-input.vue +7 -6
- package/components/hy-line/hy-line.vue +8 -6
- package/components/hy-line-progress/hy-line-progress.vue +9 -16
- package/components/hy-list/hy-list.vue +6 -5
- package/components/hy-loading/hy-loading.vue +9 -10
- package/components/hy-menu/hy-menu.vue +11 -8
- package/components/hy-modal/hy-modal.vue +6 -6
- package/components/hy-modal/index.scss +1 -1
- package/components/hy-navbar/hy-navbar.vue +6 -6
- package/components/hy-notice-bar/hy-notice-bar.vue +14 -9
- package/components/hy-notify/hy-notify.vue +6 -6
- package/components/hy-number-step/hy-number-step.vue +8 -6
- package/components/hy-overlay/hy-overlay.vue +8 -9
- package/components/hy-pagination/hy-pagination.vue +11 -8
- package/components/hy-picker/hy-picker.vue +9 -9
- package/components/hy-popover/hy-popover.vue +11 -7
- package/components/hy-popup/hy-popup.vue +9 -7
- package/components/hy-price/hy-price.vue +6 -5
- package/components/hy-qrcode/hy-qrcode.vue +6 -8
- package/components/hy-radio/hy-radio.vue +10 -12
- package/components/hy-rate/hy-rate.vue +7 -7
- package/components/hy-read-more/hy-read-more.vue +6 -5
- package/components/hy-scroll-list/hy-scroll-list.vue +6 -5
- package/components/hy-search/hy-search.vue +8 -6
- package/components/hy-signature/hy-signature.vue +6 -5
- package/components/hy-slider/hy-slider.vue +8 -7
- package/components/hy-steps/hy-steps.vue +10 -17
- package/components/hy-submit-bar/hy-submit-bar.vue +6 -6
- package/components/hy-subsection/hy-subsection.vue +16 -19
- package/components/hy-swipe-action/hy-swipe-action.vue +18 -19
- package/components/hy-swiper/hy-swiper.vue +15 -15
- package/components/hy-swiper/typing.d.ts +13 -1
- package/components/hy-switch/hy-switch.vue +17 -10
- package/components/hy-tabBar/hy-tabBar.vue +35 -26
- package/components/hy-tabs/hy-tabs.vue +28 -21
- package/components/hy-tag/hy-tag.vue +13 -17
- package/components/hy-tag/typing.d.ts +1 -1
- package/components/hy-text/hy-text.vue +12 -14
- package/components/hy-textarea/hy-textarea.vue +7 -6
- package/components/hy-textarea/index.scss +7 -2
- package/components/hy-toast/hy-toast.vue +72 -75
- package/components/hy-tooltip/hy-tooltip.vue +8 -14
- package/components/hy-transition/hy-transition.vue +8 -6
- package/components/hy-upload/hy-upload.vue +6 -5
- package/components/hy-warn/hy-warn.vue +6 -6
- package/components/hy-waterfall/hy-waterfall.vue +8 -7
- package/components/hy-watermark/hy-watermark.vue +20 -10
- package/libs/css/common.scss +5 -0
- package/libs/css/vars.css +1 -1
- package/package.json +2 -2
- package/theme.scss +1 -1
- package/utils/inspect.ts +1 -1
- package/web-types.json +1 -1
|
@@ -67,11 +67,6 @@
|
|
|
67
67
|
</template>
|
|
68
68
|
|
|
69
69
|
<script lang="ts">
|
|
70
|
-
/**
|
|
71
|
-
* 该布局一般用于商品详情页底部引导用户快速购买商品的场景,开发者可以根据自己的需求修改布局结构和样式。
|
|
72
|
-
* @displayName hy-submit-bar
|
|
73
|
-
*/
|
|
74
|
-
defineOptions({})
|
|
75
70
|
export default {
|
|
76
71
|
name: 'hy-submit-bar',
|
|
77
72
|
options: {
|
|
@@ -86,13 +81,18 @@ export default {
|
|
|
86
81
|
import { computed, toRefs } from 'vue'
|
|
87
82
|
import type { CSSProperties, PropType } from 'vue'
|
|
88
83
|
import type { IconMenus, ISubmitBarEmits } from './typing'
|
|
89
|
-
import { debounce } from '../../utils'
|
|
90
84
|
|
|
91
85
|
// 组件
|
|
92
86
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
93
87
|
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
94
88
|
import HyBadge from '../hy-badge/hy-badge.vue'
|
|
95
89
|
|
|
90
|
+
/**
|
|
91
|
+
* 该布局一般用于商品详情页底部引导用户快速购买商品的场景,开发者可以根据自己的需求修改布局结构和样式。
|
|
92
|
+
* @displayName hy-submit-bar
|
|
93
|
+
*/
|
|
94
|
+
defineOptions({})
|
|
95
|
+
|
|
96
96
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
97
97
|
const props = defineProps({
|
|
98
98
|
/** 左边菜单栏 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
ref="hy-subsection"
|
|
4
|
-
:class="[`hy-subsection--${mode}`, 'hy-subsection']"
|
|
4
|
+
:class="[`hy-subsection--${mode}`, 'hy-subsection', customClass]"
|
|
5
5
|
:style="[customStyle, wrapperStyle]"
|
|
6
6
|
>
|
|
7
7
|
<view ref="hy-subsection__bar" :style="barStyle" :class="barClass"></view>
|
|
@@ -19,11 +19,6 @@
|
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script lang="ts">
|
|
22
|
-
/**
|
|
23
|
-
* 该分段器一般用于用户从几个选项中选择某一个的场景
|
|
24
|
-
* @displayName hy-subsection
|
|
25
|
-
*/
|
|
26
|
-
defineOptions({})
|
|
27
22
|
export default {
|
|
28
23
|
name: 'hy-subsection',
|
|
29
24
|
options: {
|
|
@@ -36,15 +31,20 @@ export default {
|
|
|
36
31
|
|
|
37
32
|
<script setup lang="ts">
|
|
38
33
|
import { computed, toRefs, ref, onMounted, getCurrentInstance } from 'vue'
|
|
39
|
-
import type { CSSProperties } from 'vue'
|
|
40
|
-
import type { ISubsectionEmits } from './typing'
|
|
41
|
-
import type { SubSectionVo } from './typing'
|
|
34
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
35
|
+
import type { ISubsectionEmits, SubSectionVo } from './typing'
|
|
42
36
|
import { addUnit, getRect, guid } from '../../utils'
|
|
43
37
|
|
|
38
|
+
/**
|
|
39
|
+
* 该分段器一般用于用户从几个选项中选择某一个的场景
|
|
40
|
+
* @displayName hy-subsection
|
|
41
|
+
*/
|
|
42
|
+
defineOptions({})
|
|
43
|
+
|
|
44
44
|
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
45
45
|
const props = defineProps({
|
|
46
46
|
/** 接收值 */
|
|
47
|
-
modelValue: String,
|
|
47
|
+
modelValue: [String, Number],
|
|
48
48
|
/** 默认值 */
|
|
49
49
|
current: {
|
|
50
50
|
type: Number,
|
|
@@ -53,19 +53,12 @@ const props = defineProps({
|
|
|
53
53
|
/** tab的数据 */
|
|
54
54
|
list: {
|
|
55
55
|
type: Array,
|
|
56
|
-
default()
|
|
57
|
-
return []
|
|
58
|
-
},
|
|
56
|
+
default: () => [],
|
|
59
57
|
},
|
|
60
58
|
/** list的键值 */
|
|
61
59
|
customKeys: {
|
|
62
60
|
type: Object,
|
|
63
|
-
default() {
|
|
64
|
-
return {
|
|
65
|
-
name: 'name',
|
|
66
|
-
value: 'value',
|
|
67
|
-
}
|
|
68
|
-
},
|
|
61
|
+
default: () => ({ name: 'name', value: 'value' }),
|
|
69
62
|
},
|
|
70
63
|
/** 激活时的颜色 */
|
|
71
64
|
activeColor: String,
|
|
@@ -91,6 +84,10 @@ const props = defineProps({
|
|
|
91
84
|
},
|
|
92
85
|
/** 组件背景颜色,mode为button时有效 */
|
|
93
86
|
bgColor: String,
|
|
87
|
+
/** 定义需要用到的外部样式 */
|
|
88
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
89
|
+
/** 自定义外部类名 */
|
|
90
|
+
customClass: String,
|
|
94
91
|
})
|
|
95
92
|
const {
|
|
96
93
|
modelValue,
|
|
@@ -43,11 +43,6 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script lang="ts">
|
|
46
|
-
/**
|
|
47
|
-
* 常用于单元格左右滑删除等手势操作。
|
|
48
|
-
* @displayName hy-swipe-action
|
|
49
|
-
*/
|
|
50
|
-
defineOptions({})
|
|
51
46
|
export default {
|
|
52
47
|
name: 'hy-swipe-action',
|
|
53
48
|
options: {
|
|
@@ -74,6 +69,12 @@ import { useTouch } from '../../composables'
|
|
|
74
69
|
import { closeOther, pushToQueue, removeFromQueue } from './index'
|
|
75
70
|
import { getRect, guid } from '../../utils'
|
|
76
71
|
|
|
72
|
+
/**
|
|
73
|
+
* 常用于单元格左右滑删除等手势操作。
|
|
74
|
+
* @displayName hy-swipe-action
|
|
75
|
+
*/
|
|
76
|
+
defineOptions({})
|
|
77
|
+
|
|
77
78
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
78
79
|
const props = defineProps({
|
|
79
80
|
/**
|
|
@@ -94,22 +95,20 @@ const props = defineProps({
|
|
|
94
95
|
/** 右侧按钮内容 */
|
|
95
96
|
options: {
|
|
96
97
|
type: Array as unknown as PropType<SwipeActionStatus>,
|
|
97
|
-
default()
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
backgroundColor: '#3c9cff',
|
|
103
|
-
},
|
|
98
|
+
default: () => [
|
|
99
|
+
{
|
|
100
|
+
text: '收藏',
|
|
101
|
+
style: {
|
|
102
|
+
backgroundColor: '#3c9cff',
|
|
104
103
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
text: '删除',
|
|
107
|
+
style: {
|
|
108
|
+
backgroundColor: '#f56c6c',
|
|
110
109
|
},
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
},
|
|
111
|
+
],
|
|
113
112
|
},
|
|
114
113
|
/** 动画过渡时间,单位ms */
|
|
115
114
|
duration: {
|
|
@@ -85,11 +85,6 @@
|
|
|
85
85
|
</template>
|
|
86
86
|
|
|
87
87
|
<script lang="ts">
|
|
88
|
-
/**
|
|
89
|
-
* 一般用于导航轮播,广告展示等场景,可开箱即用
|
|
90
|
-
* @displayName hy-swiper
|
|
91
|
-
*/
|
|
92
|
-
defineOptions({})
|
|
93
88
|
export default {
|
|
94
89
|
name: 'hy-swiper',
|
|
95
90
|
options: {
|
|
@@ -101,23 +96,28 @@ export default {
|
|
|
101
96
|
</script>
|
|
102
97
|
|
|
103
98
|
<script setup lang="ts">
|
|
104
|
-
import { computed, toRefs, ref, watch, getCurrentInstance
|
|
99
|
+
import { computed, toRefs, ref, watch, getCurrentInstance } from 'vue'
|
|
100
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
105
101
|
import { addUnit, isVideo } from '../../utils'
|
|
106
102
|
import { IconConfig } from '../../config'
|
|
107
|
-
import type { ISwiperEmits, SwiperVo } from './typing'
|
|
103
|
+
import type { ISwiperEmits, SwiperList, SwiperVo } from './typing'
|
|
108
104
|
|
|
109
105
|
// 组件
|
|
110
106
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
111
107
|
import HySwiperIndicator from './hy-swiper-indicator.vue'
|
|
112
108
|
|
|
109
|
+
/**
|
|
110
|
+
* 一般用于导航轮播,广告展示等场景,可开箱即用
|
|
111
|
+
* @displayName hy-swiper
|
|
112
|
+
*/
|
|
113
|
+
defineOptions({})
|
|
114
|
+
|
|
113
115
|
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
114
116
|
const props = defineProps({
|
|
115
117
|
/** 轮播图数据 */
|
|
116
118
|
list: {
|
|
117
|
-
type: Array as
|
|
118
|
-
default()
|
|
119
|
-
return []
|
|
120
|
-
},
|
|
119
|
+
type: Array as PropType<string[] | SwiperList[]>,
|
|
120
|
+
default: () => [],
|
|
121
121
|
},
|
|
122
122
|
/** list数组中指定对象的目标属性名 */
|
|
123
123
|
keyName: {
|
|
@@ -175,12 +175,12 @@ const props = defineProps({
|
|
|
175
175
|
},
|
|
176
176
|
/** 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持 */
|
|
177
177
|
previousMargin: {
|
|
178
|
-
type: Number,
|
|
178
|
+
type: [String, Number],
|
|
179
179
|
default: 0,
|
|
180
180
|
},
|
|
181
181
|
/** 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持 */
|
|
182
182
|
nextMargin: {
|
|
183
|
-
type: Number,
|
|
183
|
+
type: [String, Number],
|
|
184
184
|
default: 0,
|
|
185
185
|
},
|
|
186
186
|
/** 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持 */
|
|
@@ -215,7 +215,7 @@ const props = defineProps({
|
|
|
215
215
|
},
|
|
216
216
|
/** 组件圆角,数值或带单位的字符串 */
|
|
217
217
|
radius: {
|
|
218
|
-
type: Number,
|
|
218
|
+
type: [String, Number],
|
|
219
219
|
default: 4,
|
|
220
220
|
},
|
|
221
221
|
/** 轮播图是否加载中数据 */
|
|
@@ -306,7 +306,7 @@ const pauseVideo = (index: number | string) => {
|
|
|
306
306
|
/**
|
|
307
307
|
* @description 当一个轮播item为视频时,获取它的视频海报
|
|
308
308
|
* */
|
|
309
|
-
const getPoster = (item: string |
|
|
309
|
+
const getPoster = (item: string | SwiperList): string => {
|
|
310
310
|
return typeof item === 'object' && item.poster ? item.poster : ''
|
|
311
311
|
}
|
|
312
312
|
|
|
@@ -100,6 +100,18 @@ export default interface HySwiperProps {
|
|
|
100
100
|
showTitle?: boolean
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
export interface SwiperList {
|
|
104
|
+
[key: string]: any
|
|
105
|
+
/** 线上地址 */
|
|
106
|
+
url?: string
|
|
107
|
+
/** 标题 */
|
|
108
|
+
title?: string
|
|
109
|
+
/** 海报,为视频必填 */
|
|
110
|
+
poster?: string
|
|
111
|
+
/** 轮播图展示类型 */
|
|
112
|
+
type?: 'image' | 'video'
|
|
113
|
+
}
|
|
114
|
+
|
|
103
115
|
export interface SwiperVo {
|
|
104
116
|
detail: {
|
|
105
117
|
current: number
|
|
@@ -108,7 +120,7 @@ export interface SwiperVo {
|
|
|
108
120
|
|
|
109
121
|
export interface ISwiperEmits {
|
|
110
122
|
/** 点击轮播图触发 */
|
|
111
|
-
(e: 'click'): void
|
|
123
|
+
(e: 'click', index: number): void
|
|
112
124
|
/** 滑动轮播图触发 */
|
|
113
125
|
(e: 'change', temp: SwiperVo['detail']): void
|
|
114
126
|
/** 滑动轮播图触发 */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
|
-
class="hy-switch cursor-pointer"
|
|
4
3
|
:class="[
|
|
4
|
+
'hy-switch cursor-pointer',
|
|
5
5
|
disabled && 'hy-switch--disabled',
|
|
6
6
|
isActive ? 'hy-switch--active' : 'hy-switch--container',
|
|
7
|
+
customClass,
|
|
7
8
|
]"
|
|
8
9
|
:style="[switchStyle, customStyle]"
|
|
9
10
|
@tap="clickHandler"
|
|
@@ -38,11 +39,6 @@
|
|
|
38
39
|
</template>
|
|
39
40
|
|
|
40
41
|
<script lang="ts">
|
|
41
|
-
/**
|
|
42
|
-
* 选择开关用于在打开和关闭状态之间进行切换。
|
|
43
|
-
* @displayName hy-switch
|
|
44
|
-
*/
|
|
45
|
-
defineOptions({})
|
|
46
42
|
export default {
|
|
47
43
|
name: 'hy-switch',
|
|
48
44
|
options: {
|
|
@@ -54,7 +50,8 @@ export default {
|
|
|
54
50
|
</script>
|
|
55
51
|
|
|
56
52
|
<script setup lang="ts">
|
|
57
|
-
import { toRefs, watch, nextTick, computed
|
|
53
|
+
import { toRefs, watch, nextTick, computed } from 'vue'
|
|
54
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
58
55
|
import { addUnit, error } from '../../utils'
|
|
59
56
|
import type { ISwitchEmits } from './typing'
|
|
60
57
|
|
|
@@ -63,11 +60,17 @@ import HyLoading from '../hy-loading/hy-loading.vue'
|
|
|
63
60
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
64
61
|
import HyIconProps from '../hy-icon/typing'
|
|
65
62
|
|
|
63
|
+
/**
|
|
64
|
+
* 选择开关用于在打开和关闭状态之间进行切换。
|
|
65
|
+
* @displayName hy-switch
|
|
66
|
+
*/
|
|
67
|
+
defineOptions({})
|
|
68
|
+
|
|
66
69
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
67
70
|
const props = defineProps({
|
|
68
71
|
/** 通过v-model双向绑定的值 */
|
|
69
72
|
modelValue: {
|
|
70
|
-
type: Boolean,
|
|
73
|
+
type: [String, Number, Boolean],
|
|
71
74
|
default: false,
|
|
72
75
|
},
|
|
73
76
|
/** 是否处于加载中 */
|
|
@@ -91,12 +94,12 @@ const props = defineProps({
|
|
|
91
94
|
inactiveColor: String,
|
|
92
95
|
/** 打开选择器时通过change事件发出的值 */
|
|
93
96
|
activeValue: {
|
|
94
|
-
type: Boolean,
|
|
97
|
+
type: [String, Number, Boolean],
|
|
95
98
|
default: true,
|
|
96
99
|
},
|
|
97
100
|
/** 关闭选择器时通过change事件发出的值 */
|
|
98
101
|
inactiveValue: {
|
|
99
|
-
type: Boolean,
|
|
102
|
+
type: [String, Number, Boolean],
|
|
100
103
|
default: false,
|
|
101
104
|
},
|
|
102
105
|
/** 打开选择器时图标 */
|
|
@@ -115,6 +118,10 @@ const props = defineProps({
|
|
|
115
118
|
type: Number,
|
|
116
119
|
default: 0,
|
|
117
120
|
},
|
|
121
|
+
/** 定义需要用到的外部样式 */
|
|
122
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
123
|
+
/** 自定义外部类名 */
|
|
124
|
+
customClass: String,
|
|
118
125
|
})
|
|
119
126
|
const {
|
|
120
127
|
modelValue,
|
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
<view class="hy-tabBar--box" :style="{ backgroundColor: barBgColor }">
|
|
5
5
|
<view class="hy-tabBar--container">
|
|
6
6
|
<view
|
|
7
|
-
:class="[
|
|
8
|
-
'hy-tabBar--container__item',
|
|
9
|
-
'list',
|
|
10
|
-
current === i ? 'is-active' : '',
|
|
11
|
-
]"
|
|
7
|
+
:class="['hy-tabBar--container__item', 'list', current === i ? 'is-active' : '']"
|
|
12
8
|
v-for="(item, i) in list"
|
|
13
9
|
:key="i"
|
|
14
10
|
@click="checkItem(i)"
|
|
@@ -31,9 +27,7 @@
|
|
|
31
27
|
></HyBadge>
|
|
32
28
|
<HyIcon :name="item.icon" :color="color" size="25"></HyIcon>
|
|
33
29
|
</view>
|
|
34
|
-
<text class="text" :style="[{ color: color }]">{{
|
|
35
|
-
item.name
|
|
36
|
-
}}</text>
|
|
30
|
+
<text class="text" :style="[{ color: color }]">{{ item.name }}</text>
|
|
37
31
|
<text class="circle"></text>
|
|
38
32
|
</view>
|
|
39
33
|
</view>
|
|
@@ -49,38 +43,53 @@
|
|
|
49
43
|
</view>
|
|
50
44
|
</template>
|
|
51
45
|
|
|
46
|
+
<script lang="ts">
|
|
47
|
+
export default {
|
|
48
|
+
name: 'hy-switch',
|
|
49
|
+
options: {
|
|
50
|
+
addGlobalClass: true,
|
|
51
|
+
virtualHost: true,
|
|
52
|
+
styleIsolation: 'shared',
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
52
57
|
<script setup lang="ts">
|
|
53
|
-
import { ref, toRefs, watch } from
|
|
54
|
-
import defaultProps from
|
|
55
|
-
import type IProps from
|
|
58
|
+
import { ref, toRefs, watch } from 'vue'
|
|
59
|
+
import defaultProps from './props'
|
|
60
|
+
import type IProps from './typing'
|
|
56
61
|
|
|
57
62
|
// 组件
|
|
58
|
-
import HyIcon from
|
|
59
|
-
import HyBadge from
|
|
63
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
64
|
+
import HyBadge from '../hy-badge/hy-badge.vue'
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 一般用于导航轮播,广告展示等场景,可开箱即用
|
|
68
|
+
* @displayName hy-swiper
|
|
69
|
+
*/
|
|
70
|
+
defineOptions({})
|
|
60
71
|
|
|
61
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
62
|
-
const { modelValue, baseBgColor } = toRefs(props)
|
|
63
|
-
const emit = defineEmits([
|
|
72
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
73
|
+
const { modelValue, baseBgColor } = toRefs(props)
|
|
74
|
+
const emit = defineEmits(['clickTab'])
|
|
64
75
|
|
|
65
|
-
const baseBackgroundColor = baseBgColor.value
|
|
66
|
-
|
|
67
|
-
: "var(--hy-background)";
|
|
68
|
-
const current = ref(0);
|
|
76
|
+
const baseBackgroundColor = baseBgColor.value ? baseBgColor.value : 'var(--hy-background)'
|
|
77
|
+
const current = ref(0)
|
|
69
78
|
watch(
|
|
70
79
|
() => modelValue.value,
|
|
71
80
|
(newVal) => {
|
|
72
|
-
current.value = newVal
|
|
81
|
+
current.value = newVal
|
|
73
82
|
},
|
|
74
|
-
)
|
|
83
|
+
)
|
|
75
84
|
|
|
76
85
|
const checkItem = (index: number) => {
|
|
77
|
-
current.value = index
|
|
78
|
-
emit(
|
|
79
|
-
}
|
|
86
|
+
current.value = index
|
|
87
|
+
emit('clickTab', index)
|
|
88
|
+
}
|
|
80
89
|
</script>
|
|
81
90
|
|
|
82
91
|
<style lang="scss" scoped>
|
|
83
|
-
@import
|
|
92
|
+
@import './index.scss';
|
|
84
93
|
.hy-tabBar {
|
|
85
94
|
background: v-bind(baseBackgroundColor);
|
|
86
95
|
&--indicator {
|
|
@@ -98,11 +98,6 @@
|
|
|
98
98
|
</template>
|
|
99
99
|
|
|
100
100
|
<script lang="ts">
|
|
101
|
-
/**
|
|
102
|
-
* 该组件是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
|
|
103
|
-
* @displayName hy-tabs
|
|
104
|
-
*/
|
|
105
|
-
defineOptions({})
|
|
106
101
|
export default {
|
|
107
102
|
name: 'hy-tabs',
|
|
108
103
|
options: {
|
|
@@ -114,25 +109,23 @@ export default {
|
|
|
114
109
|
</script>
|
|
115
110
|
|
|
116
111
|
<script setup lang="ts">
|
|
117
|
-
import {
|
|
118
|
-
|
|
119
|
-
type CSSProperties,
|
|
120
|
-
toRefs,
|
|
121
|
-
ref,
|
|
122
|
-
watch,
|
|
123
|
-
nextTick,
|
|
124
|
-
onMounted,
|
|
125
|
-
getCurrentInstance,
|
|
126
|
-
PropType,
|
|
127
|
-
} from 'vue'
|
|
112
|
+
import { computed, toRefs, ref, watch, nextTick, onMounted, getCurrentInstance } from 'vue'
|
|
113
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
128
114
|
import type { ITabsEmits } from './typing'
|
|
129
115
|
import type { TabsItemVo } from './typing'
|
|
116
|
+
import type HyBadgeProps from '../hy-badge/typing'
|
|
130
117
|
import { addUnit, getPx, getRect, sleep } from '../../utils'
|
|
131
118
|
|
|
132
119
|
// 组件
|
|
133
120
|
import HyBadge from '../hy-badge/hy-badge.vue'
|
|
134
121
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
135
122
|
|
|
123
|
+
/**
|
|
124
|
+
* 该组件是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
|
|
125
|
+
* @displayName hy-tabs
|
|
126
|
+
*/
|
|
127
|
+
defineOptions({})
|
|
128
|
+
|
|
136
129
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
137
130
|
const props = defineProps({
|
|
138
131
|
/** 标签数组,元素为对象,如[{name: '推荐'}] */
|
|
@@ -147,7 +140,7 @@ const props = defineProps({
|
|
|
147
140
|
},
|
|
148
141
|
/** 从list元素对象中读取的键名 */
|
|
149
142
|
keyName: {
|
|
150
|
-
type:
|
|
143
|
+
type: String,
|
|
151
144
|
default: 'name',
|
|
152
145
|
},
|
|
153
146
|
/** 滑块移动一次所需的时间,单位秒 */
|
|
@@ -158,9 +151,15 @@ const props = defineProps({
|
|
|
158
151
|
/** 滑块颜色 */
|
|
159
152
|
lineColor: String,
|
|
160
153
|
/** 菜单选择中时的样式 */
|
|
161
|
-
activeStyle:
|
|
154
|
+
activeStyle: {
|
|
155
|
+
type: Object as PropType<CSSProperties>,
|
|
156
|
+
default: {},
|
|
157
|
+
},
|
|
162
158
|
/** 菜单非选中时的样式 */
|
|
163
|
-
inactiveStyle:
|
|
159
|
+
inactiveStyle: {
|
|
160
|
+
type: Object as PropType<CSSProperties>,
|
|
161
|
+
default: {},
|
|
162
|
+
},
|
|
164
163
|
/** 滑块长度 */
|
|
165
164
|
lineWidth: {
|
|
166
165
|
type: [String, Number],
|
|
@@ -188,8 +187,16 @@ const props = defineProps({
|
|
|
188
187
|
type: Boolean,
|
|
189
188
|
default: true,
|
|
190
189
|
},
|
|
190
|
+
/**
|
|
191
|
+
* @description 徽标props全局定义
|
|
192
|
+
* */
|
|
193
|
+
propsBadge: Object as PropType<HyBadgeProps>,
|
|
191
194
|
/** 标签左侧图标样式自定义 */
|
|
192
195
|
iconStyle: Object as PropType<CSSProperties>,
|
|
196
|
+
/** 定义需要用到的外部样式 */
|
|
197
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
198
|
+
/** 自定义外部类名 */
|
|
199
|
+
customClass: String,
|
|
193
200
|
})
|
|
194
201
|
const { list, current, activeStyle, lineWidth, inactiveStyle } = toRefs(props)
|
|
195
202
|
const emit = defineEmits<ITabsEmits>()
|
|
@@ -226,12 +233,12 @@ const textStyle = computed(() => {
|
|
|
226
233
|
return (index: number): CSSProperties => {
|
|
227
234
|
const style: CSSProperties = {}
|
|
228
235
|
// 取当期是否激活的样式
|
|
229
|
-
const
|
|
236
|
+
const customStyle_1 = index == innerCurrent.value ? activeStyle.value : inactiveStyle.value
|
|
230
237
|
// 如果当前菜单被禁用,则加上对应颜色,需要在此做处理,是因为nvue下,无法在style样式中通过!import覆盖标签的内联样式
|
|
231
238
|
if (list.value[index]?.disabled) {
|
|
232
239
|
style.color = '#c8c9cc'
|
|
233
240
|
}
|
|
234
|
-
return Object.assign(
|
|
241
|
+
return Object.assign(customStyle_1, style)
|
|
235
242
|
}
|
|
236
243
|
})
|
|
237
244
|
|
|
@@ -38,11 +38,6 @@
|
|
|
38
38
|
</template>
|
|
39
39
|
|
|
40
40
|
<script lang="ts">
|
|
41
|
-
/**
|
|
42
|
-
* tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
|
|
43
|
-
* @displayName hy-tag
|
|
44
|
-
*/
|
|
45
|
-
defineOptions({})
|
|
46
41
|
export default {
|
|
47
42
|
name: 'hy-tag',
|
|
48
43
|
options: {
|
|
@@ -54,22 +49,29 @@ export default {
|
|
|
54
49
|
</script>
|
|
55
50
|
|
|
56
51
|
<script setup lang="ts">
|
|
57
|
-
import { computed,
|
|
52
|
+
import { computed, toRefs } from 'vue'
|
|
53
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
58
54
|
import type { ITagEmits } from './typing'
|
|
59
55
|
import { IconConfig } from '../../config'
|
|
60
56
|
import { colorGradient } from '../../utils'
|
|
61
|
-
import HyIconProps from '../hy-icon/typing'
|
|
57
|
+
import type HyIconProps from '../hy-icon/typing'
|
|
62
58
|
|
|
63
59
|
// 组件
|
|
64
60
|
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
65
61
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
66
62
|
|
|
63
|
+
/**
|
|
64
|
+
* tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
|
|
65
|
+
* @displayName hy-tag
|
|
66
|
+
*/
|
|
67
|
+
defineOptions({})
|
|
68
|
+
|
|
67
69
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
68
70
|
const props = defineProps({
|
|
69
71
|
/** 标签的文字内容 */
|
|
70
72
|
text: String,
|
|
71
73
|
/** 点击需要传得值 */
|
|
72
|
-
name: String,
|
|
74
|
+
name: [String, Number],
|
|
73
75
|
/**
|
|
74
76
|
* 标签类型
|
|
75
77
|
* @values info,primary,success,error,warning
|
|
@@ -131,14 +133,9 @@ const props = defineProps({
|
|
|
131
133
|
default: true,
|
|
132
134
|
},
|
|
133
135
|
/** 组件内置图标,或绝对路径的图片 */
|
|
134
|
-
icon:
|
|
135
|
-
type: Object as PropType<HyIconProps>,
|
|
136
|
-
default: {},
|
|
137
|
-
},
|
|
136
|
+
icon: Object as PropType<HyIconProps>,
|
|
138
137
|
/** 定义需要用到的外部样式 */
|
|
139
|
-
customStyle:
|
|
140
|
-
type: Object as PropType<CSSProperties>,
|
|
141
|
-
},
|
|
138
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
142
139
|
/** 自定义外部类名 */
|
|
143
140
|
customClass: String,
|
|
144
141
|
})
|
|
@@ -170,8 +167,7 @@ const tagClass = computed((): string[] => {
|
|
|
170
167
|
classes.push('hy-tag--disabled')
|
|
171
168
|
} else {
|
|
172
169
|
const arr = [
|
|
173
|
-
|
|
174
|
-
plain.value && `hy-tag--${type.value}--plain`,
|
|
170
|
+
plain.value ? `hy-tag--${type.value}--plain` : `hy-tag--${type.value}`,
|
|
175
171
|
plain.value && plainFill.value && `hy-tag--${type.value}--plain__fill`,
|
|
176
172
|
].filter(Boolean)
|
|
177
173
|
classes = classes.concat(arr as string[])
|
|
@@ -68,7 +68,7 @@ export default interface HyTagProps {
|
|
|
68
68
|
customStyle?: CSSProperties
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
type TagParamsVo = { value: string; name: string }
|
|
71
|
+
type TagParamsVo = { value: string; name: string | number }
|
|
72
72
|
export interface ITagEmits {
|
|
73
73
|
/** 点击标签触发 */
|
|
74
74
|
(e: 'click', params: TagParamsVo): void
|