hy-app 0.5.2 → 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.
- package/components/hy-action-sheet/index.scss +0 -5
- package/components/hy-avatar/hy-avatar.vue +4 -3
- package/components/hy-back-top/hy-back-top.vue +10 -9
- package/components/hy-back-top/props.ts +5 -3
- package/components/hy-badge/hy-badge.vue +5 -4
- package/components/hy-badge/index.scss +0 -1
- package/components/hy-badge/props.ts +11 -4
- package/components/hy-button/hy-button.vue +5 -5
- package/components/hy-button/index.scss +9 -0
- package/components/hy-button/props.ts +11 -6
- package/components/hy-coupon/hy-coupon.vue +159 -167
- package/components/hy-coupon/index.scss +135 -516
- package/components/hy-coupon/props.ts +101 -127
- package/components/hy-coupon/typing.d.ts +147 -146
- package/components/hy-datetime-picker/props.ts +1 -3
- 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 -5
- package/components/hy-folding-panel-item/index.scss +0 -8
- package/components/hy-folding-panel-item/typing.d.ts +14 -0
- package/components/hy-form-group/hy-form-group.vue +308 -511
- package/components/hy-form-group/index.scss +0 -33
- package/components/hy-form-group/props.ts +103 -13
- package/components/hy-form-group/typing.d.ts +0 -77
- package/components/hy-form-item/hy-form-item.vue +3 -3
- package/components/hy-icon/hy-icon.vue +3 -8
- package/components/hy-input/hy-input.vue +16 -10
- package/components/hy-input/index.scss +4 -0
- package/components/hy-input/props.ts +2 -2
- package/components/hy-list/props.ts +1 -1
- package/components/hy-notice-bar/hy-column-notice.vue +63 -70
- package/components/hy-notice-bar/hy-row-notice.vue +92 -110
- package/components/hy-notice-bar/index.scss +2 -4
- package/components/hy-notice-bar/props.ts +4 -1
- package/components/hy-notice-bar/typing.d.ts +2 -0
- package/components/hy-popup/hy-popup.vue +0 -1
- package/components/hy-qrcode/hy-qrcode.vue +69 -3
- package/components/hy-qrcode/index.scss +3 -3
- package/components/hy-qrcode/qrcode.js +1344 -1400
- package/components/hy-rate/hy-rate.vue +0 -1
- package/components/hy-read-more/hy-read-more.vue +1 -1
- package/components/hy-signature/hy-signature.vue +25 -22
- package/components/hy-signature/index.scss +0 -4
- package/components/hy-tabbar/hy-tabbar.vue +137 -0
- package/components/{hy-tabBar → hy-tabbar}/index.scss +30 -30
- package/components/hy-tabbar/props.ts +59 -0
- package/components/hy-tabbar/typing.d.ts +61 -0
- package/components/hy-tabbar-group/README.md +326 -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 +22 -0
- package/components/hy-tag/props.ts +8 -2
- package/components/hy-text/props.ts +8 -2
- package/components/hy-textarea/hy-textarea.vue +1 -1
- package/components/hy-textarea/index.scss +8 -7
- package/components/hy-textarea/props.ts +4 -1
- package/components/hy-toast/index.scss +2 -7
- package/components/hy-tooltip/props.ts +1 -3
- package/components/hy-upload/props.ts +1 -1
- package/components/index.ts +177 -177
- package/global.d.ts +87 -85
- package/libs/css/common.scss +0 -5
- package/libs/typing/modules/form.ts +159 -163
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-coupon/README.md +0 -133
- 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
|
@@ -1,129 +1,103 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { CouponStatus, CouponType } from "./typing";
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
+
import type { HyButtonProps } from '../hy-button/typing'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
const couponProps = {
|
|
5
|
+
/** 优惠券标题 */
|
|
6
|
+
title: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: ''
|
|
9
|
+
},
|
|
10
|
+
/**
|
|
11
|
+
* 优惠券类型:moneyOff:满减券,discount:折扣券,fixedAmount:无门槛券
|
|
12
|
+
* @values moneyOff,discount,fixedAmount
|
|
13
|
+
* */
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
18
|
+
/** 金额底部优惠券类型文字描述 */
|
|
19
|
+
typeText: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
/** 优惠券状态 */
|
|
24
|
+
status: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
/** 优惠券禁用状态 */
|
|
29
|
+
disabledStatus: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => ['']
|
|
32
|
+
},
|
|
33
|
+
/** 优惠券描述备注 */
|
|
34
|
+
description: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
38
|
+
/** 优惠券金额 */
|
|
39
|
+
amount: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
/** 优惠券单位,没有就用默认值 */
|
|
44
|
+
unit: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
48
|
+
/** 优惠券开始时间 */
|
|
49
|
+
startDate: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: ''
|
|
52
|
+
},
|
|
53
|
+
/** 优惠券结束时间 */
|
|
54
|
+
endDate: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
/** 时间格式 */
|
|
59
|
+
format: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: 'yyyy-MM-dd'
|
|
62
|
+
},
|
|
63
|
+
/** 日期描述,没有日期描述就用开始时间到结束时间 */
|
|
64
|
+
dateDesc: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ''
|
|
67
|
+
},
|
|
68
|
+
/** 背景色 */
|
|
69
|
+
bgColor: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ''
|
|
72
|
+
},
|
|
73
|
+
/** 是否显示阴影 */
|
|
74
|
+
boxShadow: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* 按钮类型
|
|
80
|
+
* @values text,button,none
|
|
81
|
+
* */
|
|
82
|
+
btnMode: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'button'
|
|
85
|
+
},
|
|
86
|
+
/** 按钮文字 */
|
|
87
|
+
btnText: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '立即领取'
|
|
90
|
+
},
|
|
91
|
+
buttonProp: {
|
|
92
|
+
type: Object as PropType<HyButtonProps>,
|
|
93
|
+
default: () => ({})
|
|
94
|
+
},
|
|
95
|
+
/** 定义需要用到的外部样式 */
|
|
96
|
+
customStyle: {
|
|
97
|
+
type: Object as PropType<CSSProperties>
|
|
98
|
+
},
|
|
99
|
+
/** 自定义外部类名 */
|
|
100
|
+
customClass: String
|
|
101
|
+
}
|
|
25
102
|
|
|
26
|
-
export
|
|
27
|
-
/** 优惠券金额 */
|
|
28
|
-
amount: {
|
|
29
|
-
type: [String, Number],
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
/** 优惠券标题 */
|
|
33
|
-
title: {
|
|
34
|
-
type: String,
|
|
35
|
-
required: true
|
|
36
|
-
},
|
|
37
|
-
/** 优惠券副标题 */
|
|
38
|
-
subTitle: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: defaultProps.subTitle
|
|
41
|
-
},
|
|
42
|
-
/**
|
|
43
|
-
* 优惠券主题类型
|
|
44
|
-
* @values primary,secondary,tertiary
|
|
45
|
-
*/
|
|
46
|
-
type: {
|
|
47
|
-
type: String as PropType<CouponType>,
|
|
48
|
-
default: defaultProps.type,
|
|
49
|
-
validator: (value: CouponType) => {
|
|
50
|
-
return ["primary", "secondary", "tertiary"].includes(value);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
/**
|
|
54
|
-
* 优惠券状态
|
|
55
|
-
* @values normal,disabled,used,expired
|
|
56
|
-
*/
|
|
57
|
-
status: {
|
|
58
|
-
type: String as PropType<CouponStatus>,
|
|
59
|
-
default: defaultProps.status,
|
|
60
|
-
validator: (value: CouponStatus) => {
|
|
61
|
-
return ["normal", "disabled", "used", "expired"].includes(value);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
/** 最小消费金额限制 */
|
|
65
|
-
minSpend: {
|
|
66
|
-
type: [String, Number],
|
|
67
|
-
default: defaultProps.minSpend
|
|
68
|
-
},
|
|
69
|
-
/** 有效期文本 */
|
|
70
|
-
validity: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: defaultProps.validity
|
|
73
|
-
},
|
|
74
|
-
/** 自定义样式 */
|
|
75
|
-
customStyle: {
|
|
76
|
-
type: Object as PropType<CSSProperties>,
|
|
77
|
-
default: () => defaultProps.customStyle
|
|
78
|
-
},
|
|
79
|
-
/** 自定义类名 */
|
|
80
|
-
customClass: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: defaultProps.customClass
|
|
83
|
-
},
|
|
84
|
-
/** 提示文本 */
|
|
85
|
-
tooltip: {
|
|
86
|
-
type: String,
|
|
87
|
-
default: defaultProps.tooltip
|
|
88
|
-
},
|
|
89
|
-
/** 是否显示操作按钮 */
|
|
90
|
-
showActionButton: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: defaultProps.showActionButton
|
|
93
|
-
},
|
|
94
|
-
/** 自定义按钮文本 */
|
|
95
|
-
customButtonText: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: defaultProps.customButtonText
|
|
98
|
-
},
|
|
99
|
-
/** 是否为专属优惠券 */
|
|
100
|
-
isExclusive: {
|
|
101
|
-
type: Boolean,
|
|
102
|
-
default: defaultProps.isExclusive
|
|
103
|
-
},
|
|
104
|
-
/** 每用户限领数量 */
|
|
105
|
-
limitPerUser: {
|
|
106
|
-
type: Number,
|
|
107
|
-
default: defaultProps.limitPerUser
|
|
108
|
-
},
|
|
109
|
-
/** 使用日期(已使用状态时显示) */
|
|
110
|
-
usedDate: {
|
|
111
|
-
type: String,
|
|
112
|
-
default: defaultProps.usedDate
|
|
113
|
-
},
|
|
114
|
-
/** 过期日期(已过期状态时显示) */
|
|
115
|
-
expireDate: {
|
|
116
|
-
type: String,
|
|
117
|
-
default: defaultProps.expireDate
|
|
118
|
-
},
|
|
119
|
-
/** 禁用原因(已禁用状态时显示) */
|
|
120
|
-
disabledReason: {
|
|
121
|
-
type: String,
|
|
122
|
-
default: defaultProps.disabledReason
|
|
123
|
-
},
|
|
124
|
-
/** 点击时是否触发receive事件 */
|
|
125
|
-
triggerReceiveOnClick: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
default: defaultProps.triggerReceiveOnClick
|
|
128
|
-
}
|
|
129
|
-
};
|
|
103
|
+
export default couponProps
|
|
@@ -1,146 +1,147 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
2
|
-
|
|
3
|
-
export type CouponStatus = '
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type CouponStatus = 'unused' | 'used' | 'expired' | 'redeemed'
|
|
4
|
+
/**
|
|
5
|
+
* moneyOff:满减券,discount:折扣券,fixedAmount:无门槛券
|
|
6
|
+
* */
|
|
7
|
+
export type CouponType = 'moneyOff' | 'discount' | 'fixedAmount'
|
|
8
|
+
|
|
9
|
+
export interface HyCouponProps {
|
|
10
|
+
/**
|
|
11
|
+
* 优惠券金额
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
amount: string
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 优惠券标题
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
title: string
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 优惠券副标题
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @default ''
|
|
26
|
+
*/
|
|
27
|
+
subTitle?: string
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 优惠券状态
|
|
31
|
+
* @type {'normal' | 'disabled' | 'used' | 'expired'}
|
|
32
|
+
* @default 'normal'
|
|
33
|
+
*/
|
|
34
|
+
status?: CouponStatus
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 最小消费金额限制
|
|
38
|
+
* @type {number}
|
|
39
|
+
* @default 0
|
|
40
|
+
*/
|
|
41
|
+
minSpend?: number
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 有效期
|
|
45
|
+
* @type {string}
|
|
46
|
+
* @default ''
|
|
47
|
+
*/
|
|
48
|
+
validity?: string
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 是否显示左边界装饰
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
showLeftBorder?: boolean
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 是否显示右边界装饰
|
|
59
|
+
* @type {boolean}
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
showRightBorder?: boolean
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 自定义样式
|
|
66
|
+
* @type {CSSProperties}
|
|
67
|
+
* @default {}
|
|
68
|
+
*/
|
|
69
|
+
customStyle?: CSSProperties
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 自定义类名
|
|
73
|
+
* @type {string}
|
|
74
|
+
* @default ''
|
|
75
|
+
*/
|
|
76
|
+
customClass?: string
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 提示文本
|
|
80
|
+
* @type {string}
|
|
81
|
+
* @default ''
|
|
82
|
+
*/
|
|
83
|
+
tooltip?: string
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 是否显示操作按钮
|
|
87
|
+
* @type {boolean}
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
90
|
+
showActionButton?: boolean
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 自定义按钮文本
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @default ''
|
|
96
|
+
*/
|
|
97
|
+
customButtonText?: string
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 是否为专属优惠券
|
|
101
|
+
* @type {boolean}
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
isExclusive?: boolean
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 每用户限领数量
|
|
108
|
+
* @type {number}
|
|
109
|
+
* @default 0
|
|
110
|
+
*/
|
|
111
|
+
limitPerUser?: number
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 使用日期(已使用状态时显示)
|
|
115
|
+
* @type {string}
|
|
116
|
+
* @default ''
|
|
117
|
+
*/
|
|
118
|
+
usedDate?: string
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 过期日期(已过期状态时显示)
|
|
122
|
+
* @type {string}
|
|
123
|
+
* @default ''
|
|
124
|
+
*/
|
|
125
|
+
expireDate?: string
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 禁用原因(已禁用状态时显示)
|
|
129
|
+
* @type {string}
|
|
130
|
+
* @default ''
|
|
131
|
+
*/
|
|
132
|
+
disabledReason?: string
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 点击时是否触发receive事件
|
|
136
|
+
* @type {boolean}
|
|
137
|
+
* @default true
|
|
138
|
+
*/
|
|
139
|
+
triggerReceiveOnClick?: boolean
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface ICouponEmits {
|
|
143
|
+
/** 点击优惠券 */
|
|
144
|
+
(e: 'click'): void
|
|
145
|
+
/** 点击使用优惠券 */
|
|
146
|
+
(e: 'used'): void
|
|
147
|
+
}
|
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
import type { Ref, ToRefs } from 'vue'
|
|
2
|
-
|
|
3
|
-
// 折叠面板组组件的Props接口
|
|
4
|
-
export interface HyFoldingPanelGroupProps {
|
|
5
|
-
/**
|
|
6
|
-
* 当前激活的面板索引,支持v-model
|
|
7
|
-
*/
|
|
8
|
-
modelValue?: number
|
|
9
|
-
/**
|
|
10
|
-
* 是否手风琴模式,默认false
|
|
11
|
-
*/
|
|
12
|
-
accordion?: boolean
|
|
13
|
-
/**
|
|
14
|
-
* 是否禁用整个折叠面板组
|
|
15
|
-
*/
|
|
16
|
-
disabled?: boolean
|
|
17
|
-
/**
|
|
18
|
-
* 是否显示边框,默认true
|
|
19
|
-
*/
|
|
20
|
-
border?: boolean
|
|
21
|
-
/**
|
|
22
|
-
* 面板大小 large, medium, small
|
|
23
|
-
*/
|
|
24
|
-
size?: HyApp.SizeType
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 父组件提供给子组件的配置接口
|
|
28
|
-
export interface HyFoldingPanelGroupConfig extends ToRefs<HyFoldingPanelGroupProps> {
|
|
29
|
-
/**
|
|
30
|
-
* 当前激活的索引
|
|
31
|
-
*/
|
|
32
|
-
activeIndex: Ref<number | string>
|
|
33
|
-
/**
|
|
34
|
-
* 更新激活索引的方法
|
|
35
|
-
*/
|
|
36
|
-
updateActiveIndex: (index: number | string) => void
|
|
37
|
-
}
|
|
38
|
-
|
|
39
1
|
// 折叠面板组组件的事件接口
|
|
40
2
|
export interface IFoldingPanelGroupEmits {
|
|
41
3
|
/**
|
|
@@ -67,8 +67,7 @@ export default {
|
|
|
67
67
|
|
|
68
68
|
<script setup lang="ts">
|
|
69
69
|
import { ref, computed, inject, onMounted } from 'vue'
|
|
70
|
-
import type {
|
|
71
|
-
import type { HyFoldingPanelGroupConfig } from '../hy-folding-panel/typing'
|
|
70
|
+
import type { IFoldingPanelConfig, IFoldingPanelItemEmits } from './typing'
|
|
72
71
|
import { addUnit, IconConfig } from '../../libs'
|
|
73
72
|
import foldingPanelItemProps from './props'
|
|
74
73
|
// 组件
|
|
@@ -86,7 +85,7 @@ const props = defineProps(foldingPanelItemProps)
|
|
|
86
85
|
const emit = defineEmits<IFoldingPanelItemEmits>()
|
|
87
86
|
|
|
88
87
|
// 尝试从父组件注入配置
|
|
89
|
-
const groupConfig = inject<
|
|
88
|
+
const groupConfig = inject<IFoldingPanelConfig>('hy-folding-panel')
|
|
90
89
|
|
|
91
90
|
// 内部展开状态
|
|
92
91
|
const expanded = ref(props.defaultOpen)
|
|
@@ -94,7 +93,6 @@ const expanded = ref(props.defaultOpen)
|
|
|
94
93
|
// 计算当前是否展开
|
|
95
94
|
const isExpanded = computed(() => {
|
|
96
95
|
if (groupConfig?.accordion?.value) {
|
|
97
|
-
console.log(groupConfig.activeIndex.value, props.index)
|
|
98
96
|
// 如果在group中,根据group的activeIndex判断
|
|
99
97
|
return groupConfig.activeIndex.value === props.index
|
|
100
98
|
}
|
|
@@ -105,7 +103,6 @@ const isExpanded = computed(() => {
|
|
|
105
103
|
// 处理点击事件
|
|
106
104
|
const handleClick = () => {
|
|
107
105
|
if (props.disabled) return
|
|
108
|
-
console.log(groupConfig?.accordion?.value)
|
|
109
106
|
|
|
110
107
|
if (groupConfig?.accordion?.value) {
|
|
111
108
|
// 在group中时,通知group更新激活索引
|
|
@@ -10,16 +10,8 @@
|
|
|
10
10
|
pointer-events: none;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
@include is(active) {
|
|
14
|
-
background-color: $hy-background--active;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
@include m(border) {
|
|
18
14
|
border-bottom: $hy-border-line;
|
|
19
|
-
|
|
20
|
-
&:last-child {
|
|
21
|
-
border-bottom: none;
|
|
22
|
-
}
|
|
23
15
|
}
|
|
24
16
|
|
|
25
17
|
@include m(large) {
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
import foldingPanelProps from '../hy-folding-panel/props'
|
|
2
|
+
import type { ExtractPropTypes, ToRefs } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface IFoldingPanelConfig extends ToRefs<ExtractPropTypes<typeof foldingPanelProps>> {
|
|
5
|
+
/**
|
|
6
|
+
* 当前激活的索引
|
|
7
|
+
*/
|
|
8
|
+
activeIndex: Ref<number | string>
|
|
9
|
+
/**
|
|
10
|
+
* 更新激活索引的方法
|
|
11
|
+
*/
|
|
12
|
+
updateActiveIndex: (index: number | string) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
// 折叠面板项组件的事件接口
|
|
2
16
|
export interface IFoldingPanelItemEmits {
|
|
3
17
|
/**
|