hy-app 0.3.0 → 0.3.2
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/README.md +6 -3
- package/common/shakeService.ts +31 -29
- package/components/avatar.zip +0 -0
- package/components/hy-action-sheet/hy-action-sheet.vue +71 -46
- package/components/hy-address-picker/hy-address-picker.vue +94 -83
- package/components/hy-avatar/hy-avatar.vue +84 -85
- package/components/hy-back-top/hy-back-top.vue +8 -6
- package/components/hy-badge/hy-badge.vue +47 -46
- package/components/hy-button/hy-button.vue +117 -93
- package/components/hy-calendar/hy-calendar.vue +168 -160
- package/components/hy-card/hy-card.vue +50 -43
- package/components/hy-card/typing.d.ts +33 -32
- package/components/hy-cell/hy-cell.vue +73 -51
- package/components/hy-check-button/hy-check-button.vue +54 -47
- package/components/hy-checkbox/hy-checkbox.vue +97 -105
- package/components/hy-code-input/hy-code-input.vue +80 -89
- package/components/hy-config-provider/hy-config-provider.vue +20 -21
- package/components/hy-count-down/hy-count-down.vue +66 -67
- package/components/hy-count-to/hy-count-to.vue +105 -99
- package/components/hy-count-to/typing.d.ts +13 -12
- package/components/hy-datetime-picker/hy-datetime-picker.vue +261 -253
- package/components/hy-datetime-picker/typing.d.ts +42 -40
- package/components/hy-divider/hy-divider.vue +68 -73
- package/components/hy-dropdown/hy-dropdown.vue +20 -19
- package/components/hy-dropdown-item/hy-dropdown-item.vue +66 -61
- package/components/hy-dropdown-item/typing.d.ts +9 -9
- package/components/hy-empty/hy-empty.vue +42 -42
- package/components/hy-flex/hy-flex.vue +99 -0
- package/components/hy-flex/index.scss +8 -0
- package/components/hy-flex/typing.d.ts +23 -0
- package/components/hy-float-button/hy-float-button.vue +218 -210
- package/components/hy-folding-panel/hy-folding-panel.vue +32 -33
- package/components/hy-form/hy-form.vue +264 -252
- package/components/hy-form/typing.d.ts +4 -0
- package/components/hy-form-group/hy-form-group.vue +114 -183
- package/components/hy-form-item/hy-form-item.vue +12 -10
- package/components/hy-form-item/index.scss +2 -2
- package/components/hy-form-item/typing.d.ts +3 -6
- package/components/hy-grid/hy-grid.vue +44 -43
- package/components/hy-icon/hy-icon.vue +61 -67
- package/components/hy-image/hy-image.vue +112 -88
- package/components/hy-image/typing.d.ts +27 -23
- package/components/hy-input/hy-input.vue +157 -127
- package/components/hy-input/typing.d.ts +53 -47
- package/components/hy-line/hy-line.vue +26 -26
- package/components/hy-line-progress/hy-line-progress.vue +42 -35
- package/components/hy-list/hy-list.vue +76 -85
- package/components/hy-loading/hy-loading.vue +26 -23
- package/components/hy-login/TheUserLogin.vue +1 -1
- package/components/hy-menu/hy-menu.vue +48 -43
- package/components/hy-menu/typing.d.ts +18 -17
- package/components/hy-modal/hy-modal.vue +39 -35
- package/components/hy-navbar/hy-navbar.vue +25 -25
- package/components/hy-navbar/typing.d.ts +24 -22
- package/components/hy-notice-bar/hy-notice-bar.vue +26 -27
- package/components/hy-notify/hy-notify.vue +53 -53
- package/components/hy-number-step/hy-number-step.vue +134 -146
- package/components/hy-number-step/typing.d.ts +35 -35
- package/components/hy-overlay/hy-overlay.vue +23 -21
- package/components/hy-pagination/hy-pagination.vue +41 -36
- package/components/hy-picker/hy-picker.vue +184 -154
- package/components/hy-picker/typing.d.ts +39 -39
- package/components/hy-popover/hy-popover.vue +97 -77
- package/components/hy-popup/hy-popup.vue +107 -98
- package/components/hy-price/hy-price.vue +38 -34
- package/components/hy-qrcode/hy-qrcode.vue +50 -51
- package/components/hy-radio/hy-radio.vue +101 -113
- package/components/hy-rate/hy-rate.vue +107 -88
- package/components/hy-read-more/hy-read-more.vue +64 -49
- package/components/hy-scroll-list/hy-scroll-list.vue +45 -48
- package/components/hy-search/hy-search.vue +73 -66
- package/components/hy-search/typing.d.ts +36 -35
- package/components/hy-signature/hy-signature.vue +282 -240
- package/components/hy-slider/hy-slider.vue +195 -153
- package/components/hy-slider/typing.d.ts +21 -21
- package/components/hy-steps/hy-steps.vue +118 -90
- package/components/hy-steps/index.scss +31 -21
- package/components/hy-submit-bar/hy-submit-bar.vue +61 -70
- package/components/hy-subsection/hy-subsection.vue +99 -102
- package/components/hy-subsection/typing.d.ts +19 -19
- package/components/hy-swipe-action/hy-swipe-action.vue +131 -118
- package/components/hy-swiper/hy-swiper.vue +85 -71
- package/components/hy-switch/hy-switch.vue +67 -72
- package/components/hy-switch/typing.d.ts +21 -19
- package/components/hy-tabs/hy-tabs.vue +168 -113
- package/components/hy-tag/hy-tag.vue +90 -86
- package/components/hy-tag/typing.d.ts +26 -21
- package/components/hy-text/hy-text.vue +119 -111
- package/components/hy-textarea/hy-textarea.vue +100 -93
- package/components/hy-textarea/typing.d.ts +36 -31
- package/components/hy-toast/hy-toast.vue +77 -67
- package/components/hy-tooltip/hy-tooltip.vue +109 -91
- package/components/hy-transition/hy-transition.vue +62 -66
- package/components/hy-upload/hy-upload.vue +294 -152
- package/components/hy-upload/typing.d.ts +41 -36
- package/components/hy-warn/hy-warn.vue +34 -27
- package/components/hy-waterfall/hy-waterfall.vue +83 -74
- package/components/hy-watermark/hy-watermark.vue +134 -115
- package/components/index.ts +1 -1
- package/composables/usePopover.ts +236 -221
- package/composables/useQueue.ts +53 -52
- package/global.d.ts +1 -0
- package/package.json +2 -2
- package/store/index.ts +9 -1
- package/theme.scss +5 -5
- package/typing/index.ts +0 -1
- package/typing/modules/common.d.ts +0 -2
- package/web-types.json +1 -1
|
@@ -59,7 +59,10 @@
|
|
|
59
59
|
v-if="showFoot"
|
|
60
60
|
class="hy-card__foot"
|
|
61
61
|
@tap="footClick"
|
|
62
|
-
:style="[
|
|
62
|
+
:style="[
|
|
63
|
+
{ padding: $slots.foot ? addUnit(paddingFoot || padding) : 0 },
|
|
64
|
+
footStyle,
|
|
65
|
+
]"
|
|
63
66
|
:class="{
|
|
64
67
|
'hy-border-top': footBorderTop,
|
|
65
68
|
}"
|
|
@@ -72,24 +75,26 @@
|
|
|
72
75
|
|
|
73
76
|
<script lang="ts">
|
|
74
77
|
export default {
|
|
75
|
-
name:
|
|
78
|
+
name: "hy-card",
|
|
76
79
|
options: {
|
|
77
80
|
addGlobalClass: true,
|
|
78
81
|
virtualHost: true,
|
|
79
|
-
styleIsolation:
|
|
82
|
+
styleIsolation: "shared",
|
|
80
83
|
},
|
|
81
|
-
}
|
|
84
|
+
};
|
|
82
85
|
</script>
|
|
83
86
|
|
|
84
87
|
<script setup lang="ts">
|
|
88
|
+
import { computed } from "vue";
|
|
89
|
+
import type { CSSProperties, PropType } from "vue";
|
|
90
|
+
import type { ICardEmits } from "./typing";
|
|
91
|
+
import { addUnit } from "../../utils";
|
|
92
|
+
|
|
85
93
|
/**
|
|
86
94
|
* 卡片组件一般用于多个列表条目,且风格统一的场景。
|
|
87
95
|
* @displayName hy-card
|
|
88
96
|
*/
|
|
89
|
-
defineOptions({})
|
|
90
|
-
import type { ICardEmits } from './typing'
|
|
91
|
-
import { addUnit } from '../../utils'
|
|
92
|
-
import { computed, type CSSProperties, PropType, toRefs } from 'vue'
|
|
97
|
+
defineOptions({});
|
|
93
98
|
|
|
94
99
|
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
95
100
|
const props = defineProps({
|
|
@@ -105,14 +110,14 @@ const props = defineProps({
|
|
|
105
110
|
/** 标题字体大小,单位rpx */
|
|
106
111
|
titleSize: {
|
|
107
112
|
type: String,
|
|
108
|
-
default:
|
|
113
|
+
default: "18px",
|
|
109
114
|
},
|
|
110
115
|
/** 头部右边的副标题 */
|
|
111
116
|
subTitle: String,
|
|
112
117
|
/** 副标题颜色 */
|
|
113
118
|
subTitleColor: {
|
|
114
119
|
type: String,
|
|
115
|
-
default:
|
|
120
|
+
default: "#909399",
|
|
116
121
|
},
|
|
117
122
|
/** 副标题字体大小 */
|
|
118
123
|
subTitleSize: {
|
|
@@ -129,7 +134,7 @@ const props = defineProps({
|
|
|
129
134
|
/** 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px" */
|
|
130
135
|
margin: {
|
|
131
136
|
type: String,
|
|
132
|
-
default:
|
|
137
|
+
default: "15px",
|
|
133
138
|
},
|
|
134
139
|
/** 卡片整体的圆角值,单位px */
|
|
135
140
|
borderRadius: {
|
|
@@ -181,7 +186,7 @@ const props = defineProps({
|
|
|
181
186
|
},
|
|
182
187
|
/** 卡片外围阴影,字符串形式 */
|
|
183
188
|
boxShadow: {
|
|
184
|
-
type: Boolean,
|
|
189
|
+
type: [Boolean, String],
|
|
185
190
|
default: true,
|
|
186
191
|
},
|
|
187
192
|
/** 头部自定义样式,对象形式 */
|
|
@@ -191,59 +196,61 @@ const props = defineProps({
|
|
|
191
196
|
/** 底部自定义样式 */
|
|
192
197
|
footStyle: Object as unknown as PropType<CSSProperties>,
|
|
193
198
|
/** 定义需要用到的外部样式 */
|
|
194
|
-
customStyle:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
customStyle: {
|
|
200
|
+
type: Object as PropType<CSSProperties>,
|
|
201
|
+
default: () => {},
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
const emit = defineEmits<ICardEmits>();
|
|
198
205
|
|
|
206
|
+
const hasBorder =
|
|
207
|
+
+(props.borderRadius.toString().replace(/\D.*$/, "") || 0) > 0;
|
|
199
208
|
const cardClass = computed(() => {
|
|
200
209
|
return [
|
|
201
|
-
border
|
|
202
|
-
full
|
|
203
|
-
border
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
].filter(Boolean)
|
|
208
|
-
})
|
|
210
|
+
props.border && "hy-border",
|
|
211
|
+
props.full && "hy-border",
|
|
212
|
+
props.border && "hy-card-full",
|
|
213
|
+
hasBorder && "hy-card--border",
|
|
214
|
+
].filter(Boolean);
|
|
215
|
+
});
|
|
209
216
|
const cardStyle = computed(() => {
|
|
210
217
|
return Object.assign(
|
|
211
218
|
{
|
|
212
|
-
borderRadius: addUnit(borderRadius
|
|
213
|
-
margin: margin
|
|
214
|
-
boxShadow: boxShadow
|
|
215
|
-
? typeof boxShadow
|
|
216
|
-
?
|
|
217
|
-
: boxShadow
|
|
218
|
-
:
|
|
219
|
+
borderRadius: addUnit(props.borderRadius),
|
|
220
|
+
margin: props.margin,
|
|
221
|
+
boxShadow: props.boxShadow
|
|
222
|
+
? typeof props.boxShadow === "boolean"
|
|
223
|
+
? "0 0 10rpx 4rpx rgba(0, 0, 0, 0.16)"
|
|
224
|
+
: props.boxShadow
|
|
225
|
+
: "",
|
|
219
226
|
},
|
|
220
|
-
customStyle
|
|
221
|
-
)
|
|
222
|
-
})
|
|
227
|
+
props.customStyle,
|
|
228
|
+
);
|
|
229
|
+
});
|
|
223
230
|
|
|
224
231
|
const click = () => {
|
|
225
|
-
emit(
|
|
226
|
-
}
|
|
232
|
+
emit("click", props.index);
|
|
233
|
+
};
|
|
227
234
|
/**
|
|
228
235
|
* @description 点击头部
|
|
229
236
|
* */
|
|
230
237
|
const headClick = () => {
|
|
231
|
-
emit(
|
|
232
|
-
}
|
|
238
|
+
emit("head-click", props.index);
|
|
239
|
+
};
|
|
233
240
|
/**
|
|
234
241
|
* @description 点击身体
|
|
235
242
|
* */
|
|
236
243
|
const bodyClick = () => {
|
|
237
|
-
emit(
|
|
238
|
-
}
|
|
244
|
+
emit("body-click", props.index);
|
|
245
|
+
};
|
|
239
246
|
/**
|
|
240
247
|
* @description 点击尾部
|
|
241
248
|
* */
|
|
242
249
|
const footClick = () => {
|
|
243
|
-
emit(
|
|
244
|
-
}
|
|
250
|
+
emit("foot-click", props.index);
|
|
251
|
+
};
|
|
245
252
|
</script>
|
|
246
253
|
|
|
247
254
|
<style lang="scss" scoped>
|
|
248
|
-
@import
|
|
255
|
+
@import "./index.scss";
|
|
249
256
|
</style>
|
|
@@ -1,123 +1,124 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
2
|
|
|
3
3
|
export default interface HyCardProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description 卡片与屏幕两侧是否留空隙(默认false)
|
|
6
6
|
* */
|
|
7
|
-
full?: boolean
|
|
7
|
+
full?: boolean;
|
|
8
8
|
/**
|
|
9
9
|
* @description 头部左边的标题
|
|
10
10
|
* */
|
|
11
|
-
title?: string
|
|
11
|
+
title?: string;
|
|
12
12
|
/**
|
|
13
13
|
* @description 标题颜色(默认#303133)
|
|
14
14
|
* */
|
|
15
|
-
titleColor?: string
|
|
15
|
+
titleColor?: string;
|
|
16
16
|
/**
|
|
17
17
|
* @description 标题字体大小,单位rpx(默认15px)
|
|
18
18
|
* */
|
|
19
|
-
titleSize?: string | number
|
|
19
|
+
titleSize?: string | number;
|
|
20
20
|
/**
|
|
21
21
|
* @description 头部右边的副标题
|
|
22
22
|
* */
|
|
23
|
-
subTitle?: string
|
|
23
|
+
subTitle?: string;
|
|
24
24
|
/**
|
|
25
25
|
* @description 副标题颜色(默认#909399)
|
|
26
26
|
* */
|
|
27
|
-
subTitleColor?: string
|
|
27
|
+
subTitleColor?: string;
|
|
28
28
|
/**
|
|
29
29
|
* @description 副标题字体大小(默认13px)
|
|
30
30
|
* */
|
|
31
|
-
subTitleSize?: string | number
|
|
31
|
+
subTitleSize?: string | number;
|
|
32
32
|
/**
|
|
33
33
|
* @description 是否显示边框(默认true)
|
|
34
34
|
* */
|
|
35
|
-
border?: boolean
|
|
35
|
+
border?: boolean;
|
|
36
36
|
/**
|
|
37
37
|
* @description 用于标识点击了第几个卡片
|
|
38
38
|
* */
|
|
39
|
-
index?: string | number
|
|
39
|
+
index?: string | number;
|
|
40
40
|
/**
|
|
41
41
|
* @description 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px"(默认15px)
|
|
42
42
|
* */
|
|
43
|
-
margin?: string
|
|
43
|
+
margin?: string;
|
|
44
44
|
/**
|
|
45
45
|
* @description 卡片整体的圆角值,单位px(默认8px)
|
|
46
46
|
* */
|
|
47
|
-
borderRadius?: string | number
|
|
47
|
+
borderRadius?: string | number;
|
|
48
48
|
/**
|
|
49
49
|
* @description 头部自定义样式,对象形式
|
|
50
50
|
* */
|
|
51
|
-
headStyle?: CSSProperties
|
|
51
|
+
headStyle?: CSSProperties;
|
|
52
52
|
/**
|
|
53
53
|
* @description 中部自定义样式,对象形式
|
|
54
54
|
* */
|
|
55
|
-
bodyStyle?: CSSProperties
|
|
55
|
+
bodyStyle?: CSSProperties;
|
|
56
56
|
/**
|
|
57
57
|
* @description 底部自定义样式,对象形式
|
|
58
58
|
* */
|
|
59
|
-
footStyle?: CSSProperties
|
|
59
|
+
footStyle?: CSSProperties;
|
|
60
60
|
/**
|
|
61
61
|
* @description 是否显示头部的下边框(默认true)
|
|
62
62
|
* */
|
|
63
|
-
headBorderBottom?: boolean
|
|
63
|
+
headBorderBottom?: boolean;
|
|
64
64
|
/**
|
|
65
65
|
* @description 是否显示底部的上边框(默认true)
|
|
66
66
|
* */
|
|
67
|
-
footBorderTop?: boolean
|
|
67
|
+
footBorderTop?: boolean;
|
|
68
68
|
/**
|
|
69
69
|
* @description 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径
|
|
70
70
|
* */
|
|
71
|
-
thumb?: string
|
|
71
|
+
thumb?: string;
|
|
72
72
|
/**
|
|
73
73
|
* @description 缩略图的宽度,高等于宽,单位px(默认30px)
|
|
74
74
|
* */
|
|
75
|
-
thumbWidth?: string | number
|
|
75
|
+
thumbWidth?: string | number;
|
|
76
76
|
/**
|
|
77
77
|
* @description 缩略图是否为圆形(默认false)
|
|
78
78
|
* */
|
|
79
|
-
thumbCircle?: boolean
|
|
79
|
+
thumbCircle?: boolean;
|
|
80
80
|
/**
|
|
81
81
|
* @description // 给head,body,foot的内边距
|
|
82
82
|
* */
|
|
83
|
-
padding?: string | number
|
|
83
|
+
padding?: string | number;
|
|
84
84
|
/**
|
|
85
85
|
* @description 头部内边距
|
|
86
86
|
* */
|
|
87
|
-
paddingHead?: string | number
|
|
87
|
+
paddingHead?: string | number;
|
|
88
88
|
/**
|
|
89
89
|
* @description 中部内边距
|
|
90
90
|
* */
|
|
91
|
-
paddingBody?: string | number
|
|
91
|
+
paddingBody?: string | number;
|
|
92
92
|
/**
|
|
93
93
|
* @description 尾部内边距
|
|
94
94
|
* */
|
|
95
|
-
paddingFoot?: string | number
|
|
95
|
+
paddingFoot?: string | number;
|
|
96
96
|
/**
|
|
97
97
|
* @description 是否显示头部(默认true)
|
|
98
98
|
* */
|
|
99
|
-
showHead?: boolean
|
|
99
|
+
showHead?: boolean;
|
|
100
100
|
/**
|
|
101
101
|
* @description 是否显示尾部(默认true)
|
|
102
102
|
* */
|
|
103
|
-
showFoot?: boolean
|
|
103
|
+
showFoot?: boolean;
|
|
104
104
|
/**
|
|
105
105
|
* @description 卡片外围阴影,字符串形式(默认true)
|
|
106
106
|
* */
|
|
107
|
-
boxShadow?: string | boolean
|
|
107
|
+
boxShadow?: string | boolean;
|
|
108
108
|
/**
|
|
109
109
|
* @description 定义需要用到的外部样式
|
|
110
110
|
* */
|
|
111
|
-
customStyle?: CSSProperties
|
|
111
|
+
customStyle?: CSSProperties;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
type IndexVo = string | number | undefined;
|
|
114
115
|
export interface ICardEmits {
|
|
115
116
|
/** 整个卡片任意位置被点击时触发 */
|
|
116
|
-
(e:
|
|
117
|
+
(e: "click", index: IndexVo): void;
|
|
117
118
|
/** 卡片头部被点击时触发 */
|
|
118
|
-
(e:
|
|
119
|
+
(e: "head-click", index: IndexVo): void;
|
|
119
120
|
/** 卡片主体部分被点击时触发 */
|
|
120
|
-
(e:
|
|
121
|
+
(e: "body-click", index: IndexVo): void;
|
|
121
122
|
/** 卡片底部部分被点击时触发 */
|
|
122
|
-
(e:
|
|
123
|
+
(e: "foot-click", index: IndexVo): void;
|
|
123
124
|
}
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
<text class="hy-cell--title__text">{{ title }}</text>
|
|
10
10
|
</slot>
|
|
11
11
|
</view>
|
|
12
|
-
<view
|
|
12
|
+
<view
|
|
13
|
+
class="hy-cell__body"
|
|
14
|
+
:style="{ 'border-radius': addUnit(borderRadius) }"
|
|
15
|
+
>
|
|
13
16
|
<!-- @slot 整体插槽 -->
|
|
14
17
|
<slot>
|
|
15
18
|
<template v-for="(item, i) in list" :key="i">
|
|
@@ -18,18 +21,24 @@
|
|
|
18
21
|
:hover-class="containerClass(item)"
|
|
19
22
|
:hover-stay-time="250"
|
|
20
23
|
:style="{
|
|
21
|
-
borderBottom:
|
|
24
|
+
borderBottom:
|
|
25
|
+
border && i !== list.length - 1 ? '1rpx solid #c8c7cc66' : '',
|
|
22
26
|
}"
|
|
23
27
|
@tap="clickHandler($event, item, i)"
|
|
24
28
|
>
|
|
25
29
|
<view class="hy-cell__body--container__content">
|
|
26
|
-
<view
|
|
30
|
+
<view
|
|
31
|
+
v-if="item?.icon?.name || $slots.icon"
|
|
32
|
+
class="hy-cell__body--container__content-icon"
|
|
33
|
+
>
|
|
27
34
|
<!-- @slot 图标插槽 -->
|
|
28
35
|
<slot name="icon" :icon="item?.icon">
|
|
29
36
|
<HyIcon
|
|
30
37
|
:size="iconSize"
|
|
31
38
|
:name="item?.icon?.name"
|
|
32
|
-
:color="
|
|
39
|
+
:color="
|
|
40
|
+
disabled || item?.disabled ? '#c0c0c0' : item?.icon?.color
|
|
41
|
+
"
|
|
33
42
|
:bold="item?.icon?.bold"
|
|
34
43
|
:customPrefix="item?.icon?.customPrefix"
|
|
35
44
|
:imgMode="item?.icon?.imgMode"
|
|
@@ -48,7 +57,9 @@
|
|
|
48
57
|
<slot name="cell-title" :title="item?.title">
|
|
49
58
|
<text
|
|
50
59
|
class="hy-cell__body--container__content-title--text"
|
|
51
|
-
:class="[
|
|
60
|
+
:class="[
|
|
61
|
+
(disabled || item?.disabled) && 'hy-cell--disabled',
|
|
62
|
+
]"
|
|
52
63
|
>
|
|
53
64
|
{{ item?.title }}
|
|
54
65
|
</text>
|
|
@@ -68,7 +79,11 @@
|
|
|
68
79
|
class="hy-cell__body--container__center"
|
|
69
80
|
:style="{
|
|
70
81
|
justifyContent:
|
|
71
|
-
arrange === 'left'
|
|
82
|
+
arrange === 'left'
|
|
83
|
+
? 'flex-start'
|
|
84
|
+
: arrange === 'right'
|
|
85
|
+
? 'flex-end'
|
|
86
|
+
: 'center',
|
|
72
87
|
}"
|
|
73
88
|
>
|
|
74
89
|
<!-- @slot 值内容插槽 -->
|
|
@@ -91,21 +106,27 @@
|
|
|
91
106
|
<!-- @slot 右边按钮插槽 -->
|
|
92
107
|
<slot name="right-icon" :icon="item?.rightIcon || rightIcon">
|
|
93
108
|
<HyIcon
|
|
94
|
-
:name="
|
|
109
|
+
:name="
|
|
110
|
+
item?.rightIcon?.name || rightIcon?.name || IconConfig.RIGHT
|
|
111
|
+
"
|
|
95
112
|
:color="
|
|
96
113
|
disabled || item?.disabled
|
|
97
114
|
? '#c0c0c0'
|
|
98
115
|
: item?.rightIcon?.color || rightIcon?.color
|
|
99
116
|
"
|
|
100
117
|
:bold="item?.rightIcon?.bold || rightIcon?.bold"
|
|
101
|
-
:customPrefix="
|
|
118
|
+
:customPrefix="
|
|
119
|
+
item?.rightIcon?.customPrefix || rightIcon?.customPrefix
|
|
120
|
+
"
|
|
102
121
|
:imgMode="item?.rightIcon?.imgMode || rightIcon?.imgMode"
|
|
103
122
|
:width="item?.rightIcon?.width || rightIcon?.width"
|
|
104
123
|
:height="item?.rightIcon?.height || rightIcon?.height"
|
|
105
124
|
:top="item?.rightIcon?.top || rightIcon?.name"
|
|
106
125
|
:stop="item?.rightIcon?.stop || rightIcon?.stop"
|
|
107
126
|
:round="item?.rightIcon?.round || rightIcon?.round"
|
|
108
|
-
:customStyle="
|
|
127
|
+
:customStyle="
|
|
128
|
+
item?.rightIcon?.customStyle || rightIcon?.customStyle
|
|
129
|
+
"
|
|
109
130
|
></HyIcon>
|
|
110
131
|
</slot>
|
|
111
132
|
</view>
|
|
@@ -121,31 +142,30 @@
|
|
|
121
142
|
|
|
122
143
|
<script lang="ts">
|
|
123
144
|
export default {
|
|
124
|
-
name:
|
|
145
|
+
name: "hy-cell",
|
|
125
146
|
options: {
|
|
126
147
|
virtualHost: true,
|
|
127
|
-
styleIsolation:
|
|
148
|
+
styleIsolation: "shared",
|
|
128
149
|
},
|
|
129
|
-
}
|
|
150
|
+
};
|
|
130
151
|
</script>
|
|
131
152
|
|
|
132
153
|
<script setup lang="ts">
|
|
133
|
-
import { computed
|
|
134
|
-
import type { CSSProperties, PropType } from
|
|
135
|
-
import type { ICellEmits } from
|
|
136
|
-
import type { CellContentVo } from
|
|
137
|
-
import { IconConfig } from
|
|
138
|
-
import { addUnit } from
|
|
139
|
-
|
|
154
|
+
import { computed } from "vue";
|
|
155
|
+
import type { CSSProperties, PropType } from "vue";
|
|
156
|
+
import type { ICellEmits } from "./typing";
|
|
157
|
+
import type { CellContentVo } from "./typing";
|
|
158
|
+
import { IconConfig } from "../../config";
|
|
159
|
+
import { addUnit } from "../../utils";
|
|
140
160
|
// 组件
|
|
141
|
-
import HyIcon from
|
|
142
|
-
import type HyIconProps from
|
|
161
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
162
|
+
import type HyIconProps from "../hy-icon/typing";
|
|
143
163
|
|
|
144
164
|
/**
|
|
145
165
|
* cell单元格一般用于一组列表的情况,比如个人中心页,设置页等
|
|
146
166
|
* @displayName hy-cell
|
|
147
167
|
*/
|
|
148
|
-
defineOptions({})
|
|
168
|
+
defineOptions({});
|
|
149
169
|
|
|
150
170
|
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
151
171
|
const props = defineProps({
|
|
@@ -170,7 +190,7 @@ const props = defineProps({
|
|
|
170
190
|
/** 圆角 */
|
|
171
191
|
borderRadius: {
|
|
172
192
|
type: [String, Number],
|
|
173
|
-
default:
|
|
193
|
+
default: "5px",
|
|
174
194
|
},
|
|
175
195
|
/** 是否禁用cell */
|
|
176
196
|
disabled: {
|
|
@@ -188,7 +208,7 @@ const props = defineProps({
|
|
|
188
208
|
* */
|
|
189
209
|
size: {
|
|
190
210
|
type: [String, Number],
|
|
191
|
-
default:
|
|
211
|
+
default: "medium",
|
|
192
212
|
},
|
|
193
213
|
/** 右侧的内容 */
|
|
194
214
|
value: String,
|
|
@@ -198,7 +218,7 @@ const props = defineProps({
|
|
|
198
218
|
* */
|
|
199
219
|
arrange: {
|
|
200
220
|
type: String,
|
|
201
|
-
default:
|
|
221
|
+
default: "right",
|
|
202
222
|
},
|
|
203
223
|
/** cell列表数据 */
|
|
204
224
|
rightIcon: {
|
|
@@ -210,13 +230,12 @@ const props = defineProps({
|
|
|
210
230
|
* */
|
|
211
231
|
arrowDirection: {
|
|
212
232
|
type: String,
|
|
213
|
-
default:
|
|
233
|
+
default: "right",
|
|
214
234
|
},
|
|
215
235
|
/** 定义需要用到的外部样式 */
|
|
216
236
|
customStyle: Object as PropType<CSSProperties>,
|
|
217
|
-
})
|
|
218
|
-
const
|
|
219
|
-
const emit = defineEmits<ICellEmits>()
|
|
237
|
+
});
|
|
238
|
+
const emit = defineEmits<ICellEmits>();
|
|
220
239
|
|
|
221
240
|
/**
|
|
222
241
|
* @description 计算什么时候出现点击状态
|
|
@@ -224,45 +243,48 @@ const emit = defineEmits<ICellEmits>()
|
|
|
224
243
|
const containerClass = computed(() => {
|
|
225
244
|
return (temp: CellContentVo): string => {
|
|
226
245
|
return [
|
|
227
|
-
!disabled
|
|
246
|
+
!props.disabled &&
|
|
228
247
|
!temp?.disabled &&
|
|
229
|
-
clickable
|
|
230
|
-
|
|
248
|
+
props.clickable &&
|
|
249
|
+
"hy-cell__body--container__clickable",
|
|
231
250
|
]
|
|
232
251
|
.filter(Boolean)
|
|
233
|
-
.join()
|
|
234
|
-
}
|
|
235
|
-
})
|
|
252
|
+
.join();
|
|
253
|
+
};
|
|
254
|
+
});
|
|
236
255
|
const ItemClass = computed(() => {
|
|
237
|
-
return [
|
|
238
|
-
|
|
256
|
+
return [
|
|
257
|
+
"hy-cell__body--container",
|
|
258
|
+
`hy-cell__body--container__${props.size}`,
|
|
259
|
+
];
|
|
260
|
+
});
|
|
239
261
|
|
|
240
262
|
const iconSize = computed(() => {
|
|
241
|
-
switch (size
|
|
242
|
-
case
|
|
243
|
-
return 25
|
|
244
|
-
case
|
|
245
|
-
return 20
|
|
246
|
-
case
|
|
247
|
-
return 15
|
|
263
|
+
switch (props.size) {
|
|
264
|
+
case "large":
|
|
265
|
+
return 25;
|
|
266
|
+
case "medium":
|
|
267
|
+
return 20;
|
|
268
|
+
case "small":
|
|
269
|
+
return 15;
|
|
248
270
|
}
|
|
249
|
-
})
|
|
271
|
+
});
|
|
250
272
|
|
|
251
273
|
/**
|
|
252
274
|
* @description 点击cell
|
|
253
275
|
* */
|
|
254
276
|
const clickHandler = (e: Event, temp: CellContentVo, index: number) => {
|
|
255
|
-
if (disabled
|
|
256
|
-
emit(
|
|
277
|
+
if (props.disabled) return;
|
|
278
|
+
emit("click", temp, index);
|
|
257
279
|
if (temp?.url) {
|
|
258
280
|
uni.navigateTo({
|
|
259
281
|
url: temp.url,
|
|
260
|
-
})
|
|
282
|
+
});
|
|
261
283
|
}
|
|
262
|
-
e.stopPropagation()
|
|
263
|
-
}
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
};
|
|
264
286
|
</script>
|
|
265
287
|
|
|
266
288
|
<style lang="scss" scoped>
|
|
267
|
-
@import
|
|
289
|
+
@import "./index.scss";
|
|
268
290
|
</style>
|