uview-pro 0.0.1
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/changelog.md +6 -0
- package/components/u-action-sheet/u-action-sheet.vue +205 -0
- package/components/u-alert-tips/u-alert-tips.vue +241 -0
- package/components/u-avatar/u-avatar.vue +220 -0
- package/components/u-avatar-cropper/u-avatar-cropper.vue +329 -0
- package/components/u-avatar-cropper/weCropper.d.ts +54 -0
- package/components/u-avatar-cropper/weCropper.js +1267 -0
- package/components/u-avatar-cropper/weCropper.ts +1254 -0
- package/components/u-back-top/u-back-top.vue +156 -0
- package/components/u-badge/u-badge.vue +189 -0
- package/components/u-button/u-button.vue +562 -0
- package/components/u-calendar/u-calendar.vue +725 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +236 -0
- package/components/u-card/u-card.vue +240 -0
- package/components/u-cell-group/u-cell-group.vue +56 -0
- package/components/u-cell-item/u-cell-item.vue +245 -0
- package/components/u-checkbox/u-checkbox.vue +310 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +134 -0
- package/components/u-circle-progress/u-circle-progress.vue +210 -0
- package/components/u-col/u-col.vue +135 -0
- package/components/u-collapse/u-collapse.vue +82 -0
- package/components/u-collapse-item/u-collapse-item.vue +190 -0
- package/components/u-column-notice/u-column-notice.vue +264 -0
- package/components/u-count-down/u-count-down.vue +333 -0
- package/components/u-count-to/u-count-to.vue +297 -0
- package/components/u-divider/u-divider.vue +141 -0
- package/components/u-dropdown/u-dropdown.vue +311 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +135 -0
- package/components/u-empty/u-empty.vue +111 -0
- package/components/u-field/u-field.vue +469 -0
- package/components/u-form/u-form.vue +162 -0
- package/components/u-form-item/u-form-item.vue +476 -0
- package/components/u-full-screen/u-full-screen.vue +80 -0
- package/components/u-gap/u-gap.vue +48 -0
- package/components/u-grid/u-grid.vue +101 -0
- package/components/u-grid-item/u-grid-item.vue +136 -0
- package/components/u-icon/u-icon.vue +389 -0
- package/components/u-image/types.ts +48 -0
- package/components/u-image/u-image.vue +218 -0
- package/components/u-index-anchor/u-index-anchor.vue +101 -0
- package/components/u-index-list/u-index-list.vue +376 -0
- package/components/u-input/u-input.vue +462 -0
- package/components/u-keyboard/u-keyboard.vue +188 -0
- package/components/u-lazy-load/u-lazy-load.vue +288 -0
- package/components/u-line/u-line.vue +71 -0
- package/components/u-line-progress/u-line-progress.vue +128 -0
- package/components/u-link/u-link.vue +87 -0
- package/components/u-loading/u-loading.vue +111 -0
- package/components/u-loadmore/u-loadmore.vue +205 -0
- package/components/u-mask/u-mask.vue +137 -0
- package/components/u-message-input/u-message-input.vue +315 -0
- package/components/u-modal/u-modal.vue +284 -0
- package/components/u-navbar/u-navbar.vue +314 -0
- package/components/u-no-network/image.ts +2 -0
- package/components/u-no-network/u-no-network.vue +311 -0
- package/components/u-notice-bar/u-notice-bar.vue +274 -0
- package/components/u-number-box/u-number-box.vue +344 -0
- package/components/u-number-keyboard/u-number-keyboard.vue +170 -0
- package/components/u-parse/libs/CssHandler.js +100 -0
- package/components/u-parse/libs/MpHtmlParser.js +580 -0
- package/components/u-parse/libs/config.js +80 -0
- package/components/u-parse/libs/handler.wxs +22 -0
- package/components/u-parse/libs/trees.vue +505 -0
- package/components/u-parse/u-parse.vue +645 -0
- package/components/u-picker/u-picker.vue +808 -0
- package/components/u-popup/u-popup.vue +404 -0
- package/components/u-radio/u-radio.vue +272 -0
- package/components/u-radio-group/u-radio-group.vue +116 -0
- package/components/u-rate/u-rate.vue +349 -0
- package/components/u-read-more/u-read-more.vue +199 -0
- package/components/u-row/u-row.vue +95 -0
- package/components/u-row-notice/u-row-notice.vue +273 -0
- package/components/u-search/u-search.vue +298 -0
- package/components/u-section/u-section.vue +175 -0
- package/components/u-select/u-select.vue +387 -0
- package/components/u-skeleton/u-skeleton.vue +230 -0
- package/components/u-slider/u-slider.vue +293 -0
- package/components/u-steps/u-steps.vue +200 -0
- package/components/u-sticky/u-sticky.vue +189 -0
- package/components/u-subsection/u-subsection.vue +388 -0
- package/components/u-swipe-action/u-swipe-action.vue +289 -0
- package/components/u-swiper/u-swiper.vue +305 -0
- package/components/u-switch/u-switch.vue +146 -0
- package/components/u-tabbar/u-tabbar.vue +347 -0
- package/components/u-table/u-table.vue +104 -0
- package/components/u-tabs/u-tabs.vue +322 -0
- package/components/u-tabs-swiper/u-tabs-swiper.vue +426 -0
- package/components/u-tag/u-tag.vue +270 -0
- package/components/u-td/u-td.vue +76 -0
- package/components/u-th/u-th.vue +70 -0
- package/components/u-time-line/u-time-line.vue +39 -0
- package/components/u-time-line-item/u-time-line-item.vue +88 -0
- package/components/u-toast/types.ts +4 -0
- package/components/u-toast/u-toast.vue +238 -0
- package/components/u-top-tips/u-top-tips.vue +118 -0
- package/components/u-tr/u-tr.vue +24 -0
- package/components/u-upload/u-upload.vue +600 -0
- package/components/u-verification-code/u-verification-code.vue +194 -0
- package/components/u-waterfall/u-waterfall.vue +186 -0
- package/iconfont.css +910 -0
- package/index.scss +23 -0
- package/index.ts +166 -0
- package/libs/config/config.ts +26 -0
- package/libs/config/zIndex.ts +37 -0
- package/libs/css/color.scss +155 -0
- package/libs/css/common.scss +176 -0
- package/libs/css/style.components.scss +7 -0
- package/libs/css/style.h5.scss +8 -0
- package/libs/css/style.mp.scss +72 -0
- package/libs/css/style.nvue.scss +3 -0
- package/libs/css/style.vue.scss +175 -0
- package/libs/function/$parent.ts +22 -0
- package/libs/function/addUnit.ts +13 -0
- package/libs/function/color.ts +37 -0
- package/libs/function/colorGradient.ts +123 -0
- package/libs/function/debounce.ts +28 -0
- package/libs/function/deepClone.ts +39 -0
- package/libs/function/deepMerge.ts +34 -0
- package/libs/function/getParent.ts +59 -0
- package/libs/function/getRect.ts +26 -0
- package/libs/function/guid.ts +42 -0
- package/libs/function/md5.ts +397 -0
- package/libs/function/parent.ts +21 -0
- package/libs/function/queryParams.ts +60 -0
- package/libs/function/random.ts +16 -0
- package/libs/function/randomArray.ts +11 -0
- package/libs/function/route.ts +118 -0
- package/libs/function/sys.ts +15 -0
- package/libs/function/test.ts +229 -0
- package/libs/function/throttle.ts +31 -0
- package/libs/function/timeFormat.ts +54 -0
- package/libs/function/timeFrom.ts +48 -0
- package/libs/function/toast.ts +14 -0
- package/libs/function/trim.ts +21 -0
- package/libs/function/type2icon.ts +36 -0
- package/libs/hooks/useEmitter.ts +77 -0
- package/libs/hooks/useParent.ts +29 -0
- package/libs/request/index.ts +237 -0
- package/libs/store/index.ts +88 -0
- package/libs/util/area.ts +1 -0
- package/libs/util/async-validator.js +1356 -0
- package/libs/util/city.ts +1 -0
- package/libs/util/emitter.ts +112 -0
- package/libs/util/mitt.ts +118 -0
- package/libs/util/parent.ts +20 -0
- package/libs/util/province.ts +1 -0
- package/package.json +98 -0
- package/readme.md +165 -0
- package/theme.scss +38 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-keyboard" @touchmove.stop.prevent="() => {}">
|
|
3
|
+
<view class="u-keyboard-grids">
|
|
4
|
+
<view>
|
|
5
|
+
<view class="u-keyboard-grids-item" v-for="(group, i) in abc ? EngKeyBoardList : areaList" :key="i">
|
|
6
|
+
<view :hover-stay-time="100" @tap="carInputClick(i, j)" hover-class="u-carinput-hover" class="u-keyboard-grids-btn" v-for="(item, j) in group" :key="j">
|
|
7
|
+
{{ item }}
|
|
8
|
+
</view>
|
|
9
|
+
</view>
|
|
10
|
+
<view @touchstart="backspaceClick" @touchend="clearTimer" :hover-stay-time="100" class="u-keyboard-back" hover-class="u-hover-class">
|
|
11
|
+
<u-icon :size="38" name="backspace" :bold="true"></u-icon>
|
|
12
|
+
</view>
|
|
13
|
+
<view :hover-stay-time="100" class="u-keyboard-change" hover-class="u-carinput-hover" @tap="changeCarInputMode">
|
|
14
|
+
<text class="zh" :class="[!abc ? 'active' : 'inactive']">中</text>
|
|
15
|
+
/
|
|
16
|
+
<text class="en" :class="[abc ? 'active' : 'inactive']">英</text>
|
|
17
|
+
</view>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { ref, computed } from 'vue';
|
|
25
|
+
import { $u } from '../..';
|
|
26
|
+
|
|
27
|
+
defineOptions({
|
|
28
|
+
name: 'u-car-keyboard'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* u-car-keyboard 车牌号键盘
|
|
33
|
+
* @description 车牌号输入专用键盘,支持省份简称和字母数字切换,支持按键顺序打乱。
|
|
34
|
+
* @property {Boolean} random 是否打乱键盘按键的顺序(默认false)
|
|
35
|
+
* @event {Function} change 按键被点击
|
|
36
|
+
* @event {Function} backspace 退格键被点击
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
/** 是否打乱键盘按键的顺序 */
|
|
41
|
+
random: { type: Boolean, default: false }
|
|
42
|
+
});
|
|
43
|
+
const emit = defineEmits(['change', 'backspace']);
|
|
44
|
+
|
|
45
|
+
// 车牌输入时,abc=true为输入车牌号码,abc=false为输入省份中文简称
|
|
46
|
+
const abc = ref(false);
|
|
47
|
+
let timer: ReturnType<typeof setInterval> | null = null;
|
|
48
|
+
|
|
49
|
+
const areaList = computed(() => {
|
|
50
|
+
let data = [
|
|
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
|
+
let tmp: string[][] = [];
|
|
89
|
+
// 打乱顺序
|
|
90
|
+
if (props.random) {
|
|
91
|
+
data = $u.randomArray(data);
|
|
92
|
+
}
|
|
93
|
+
tmp[0] = data.slice(0, 10);
|
|
94
|
+
tmp[1] = data.slice(10, 20);
|
|
95
|
+
tmp[2] = data.slice(20, 30);
|
|
96
|
+
tmp[3] = data.slice(30, 36);
|
|
97
|
+
return tmp;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const EngKeyBoardList = computed(() => {
|
|
101
|
+
let data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M'];
|
|
102
|
+
let tmp: (string | number)[][] = [];
|
|
103
|
+
if (props.random) {
|
|
104
|
+
data = $u.randomArray(data);
|
|
105
|
+
}
|
|
106
|
+
tmp[0] = data.slice(0, 10);
|
|
107
|
+
tmp[1] = data.slice(10, 20);
|
|
108
|
+
tmp[2] = data.slice(20, 30);
|
|
109
|
+
tmp[3] = data.slice(30, 36);
|
|
110
|
+
return tmp;
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 点击键盘按钮
|
|
115
|
+
*/
|
|
116
|
+
function carInputClick(i: number, j: number) {
|
|
117
|
+
let value = '';
|
|
118
|
+
// 不同模式,获取不同数组的值
|
|
119
|
+
if (abc.value) value = String(EngKeyBoardList.value[i][j]);
|
|
120
|
+
else value = String(areaList.value[i][j]);
|
|
121
|
+
emit('change', value);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 修改汽车牌键盘的输入模式,中文|英文
|
|
126
|
+
*/
|
|
127
|
+
function changeCarInputMode() {
|
|
128
|
+
abc.value = !abc.value;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 点击退格键
|
|
133
|
+
*/
|
|
134
|
+
function backspaceClick() {
|
|
135
|
+
emit('backspace');
|
|
136
|
+
if (timer) clearInterval(timer);
|
|
137
|
+
timer = setInterval(() => {
|
|
138
|
+
emit('backspace');
|
|
139
|
+
}, 250);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function clearTimer() {
|
|
143
|
+
if (timer) clearInterval(timer);
|
|
144
|
+
timer = null;
|
|
145
|
+
}
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<style lang="scss" scoped>
|
|
149
|
+
@import '../../libs/css/style.components.scss';
|
|
150
|
+
|
|
151
|
+
.u-keyboard-grids {
|
|
152
|
+
background: rgb(215, 215, 217);
|
|
153
|
+
padding: 24rpx 0;
|
|
154
|
+
position: relative;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.u-keyboard-grids-item {
|
|
158
|
+
@include vue-flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.u-keyboard-grids-btn {
|
|
164
|
+
text-decoration: none;
|
|
165
|
+
width: 62rpx;
|
|
166
|
+
flex: 0 0 64rpx;
|
|
167
|
+
height: 80rpx;
|
|
168
|
+
/* #ifndef APP-NVUE */
|
|
169
|
+
display: inline-flex;
|
|
170
|
+
/* #endif */
|
|
171
|
+
font-size: 36rpx;
|
|
172
|
+
text-align: center;
|
|
173
|
+
line-height: 80rpx;
|
|
174
|
+
background-color: #fff;
|
|
175
|
+
margin: 8rpx 5rpx;
|
|
176
|
+
border-radius: 8rpx;
|
|
177
|
+
box-shadow: 0 2rpx 0rpx #888992;
|
|
178
|
+
font-weight: 500;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.u-carinput-hover {
|
|
183
|
+
background-color: rgb(185, 188, 195) !important;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.u-keyboard-back {
|
|
187
|
+
position: absolute;
|
|
188
|
+
width: 96rpx;
|
|
189
|
+
right: 22rpx;
|
|
190
|
+
bottom: 32rpx;
|
|
191
|
+
height: 80rpx;
|
|
192
|
+
background-color: rgb(185, 188, 195);
|
|
193
|
+
@include vue-flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
border-radius: 8rpx;
|
|
196
|
+
justify-content: center;
|
|
197
|
+
box-shadow: 0 2rpx 0rpx #888992;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.u-keyboard-change {
|
|
201
|
+
font-size: 24rpx;
|
|
202
|
+
box-shadow: 0 2rpx 0rpx #888992;
|
|
203
|
+
position: absolute;
|
|
204
|
+
width: 96rpx;
|
|
205
|
+
left: 22rpx;
|
|
206
|
+
line-height: 1;
|
|
207
|
+
bottom: 32rpx;
|
|
208
|
+
height: 80rpx;
|
|
209
|
+
background-color: #ffffff;
|
|
210
|
+
@include vue-flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
border-radius: 8rpx;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.u-keyboard-change .inactive.zh {
|
|
217
|
+
transform: scale(0.85) translateY(-10rpx);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.u-keyboard-change .inactive.en {
|
|
221
|
+
transform: scale(0.85) translateY(10rpx);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.u-keyboard-change .active {
|
|
225
|
+
color: rgb(237, 112, 64);
|
|
226
|
+
font-size: 30rpx;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.u-keyboard-change .zh {
|
|
230
|
+
transform: translateY(-10rpx);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.u-keyboard-change .en {
|
|
234
|
+
transform: translateY(10rpx);
|
|
235
|
+
}
|
|
236
|
+
</style>
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-card"
|
|
4
|
+
@tap.stop="onClick"
|
|
5
|
+
:class="{ 'u-border': border, 'u-card-full': full, 'u-card--border': Number(borderRadius) > 0 }"
|
|
6
|
+
:style="{
|
|
7
|
+
borderRadius: borderRadius + 'rpx',
|
|
8
|
+
margin: margin,
|
|
9
|
+
boxShadow: boxShadow
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
<view
|
|
13
|
+
v-if="showHead"
|
|
14
|
+
class="u-card__head"
|
|
15
|
+
:style="[{ padding: padding + 'rpx' }, headStyle]"
|
|
16
|
+
:class="{
|
|
17
|
+
'u-border-bottom': headBorderBottom
|
|
18
|
+
}"
|
|
19
|
+
@tap="onHeadClick"
|
|
20
|
+
>
|
|
21
|
+
<view v-if="!slots.head" class="u-flex u-row-between">
|
|
22
|
+
<view class="u-card__head--left u-flex u-line-1" v-if="title">
|
|
23
|
+
<image
|
|
24
|
+
:src="thumb"
|
|
25
|
+
class="u-card__head--left__thumb"
|
|
26
|
+
mode="aspectFill"
|
|
27
|
+
v-if="thumb"
|
|
28
|
+
:style="{
|
|
29
|
+
height: thumbWidth + 'rpx',
|
|
30
|
+
width: thumbWidth + 'rpx',
|
|
31
|
+
borderRadius: thumbCircle ? '100rpx' : '6rpx'
|
|
32
|
+
}"
|
|
33
|
+
></image>
|
|
34
|
+
<text
|
|
35
|
+
class="u-card__head--left__title u-line-1"
|
|
36
|
+
:style="{
|
|
37
|
+
fontSize: titleSize + 'rpx',
|
|
38
|
+
color: titleColor
|
|
39
|
+
}"
|
|
40
|
+
>
|
|
41
|
+
{{ title }}
|
|
42
|
+
</text>
|
|
43
|
+
</view>
|
|
44
|
+
<view class="u-card__head--right u-line-1" v-if="subTitle">
|
|
45
|
+
<text
|
|
46
|
+
class="u-card__head__title__text"
|
|
47
|
+
:style="{
|
|
48
|
+
fontSize: subTitleSize + 'rpx',
|
|
49
|
+
color: subTitleColor
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
{{ subTitle }}
|
|
53
|
+
</text>
|
|
54
|
+
</view>
|
|
55
|
+
</view>
|
|
56
|
+
<slot name="head" v-else />
|
|
57
|
+
</view>
|
|
58
|
+
<view @tap="onBodyClick" class="u-card__body" :style="[{ padding: padding + 'rpx' }, bodyStyle]">
|
|
59
|
+
<slot name="body" />
|
|
60
|
+
</view>
|
|
61
|
+
<view
|
|
62
|
+
v-if="showFoot"
|
|
63
|
+
class="u-card__foot"
|
|
64
|
+
@tap="onFootClick"
|
|
65
|
+
:style="[{ padding: slots.foot ? padding + 'rpx' : 0 }, footStyle]"
|
|
66
|
+
:class="{
|
|
67
|
+
'u-border-top': footBorderTop
|
|
68
|
+
}"
|
|
69
|
+
>
|
|
70
|
+
<slot name="foot" />
|
|
71
|
+
</view>
|
|
72
|
+
</view>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script setup lang="ts">
|
|
76
|
+
import { useSlots } from 'vue';
|
|
77
|
+
|
|
78
|
+
defineOptions({
|
|
79
|
+
name: 'u-card'
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* card 卡片
|
|
84
|
+
* @description 卡片组件一般用于多个列表条目,且风格统一的场景
|
|
85
|
+
* @tutorial https://www.uviewui.com/components/card.html
|
|
86
|
+
* @property {Boolean} full 卡片与屏幕两侧是否留空隙(默认false)
|
|
87
|
+
* @property {String} title 头部左边的标题
|
|
88
|
+
* @property {String} title-color 标题颜色(默认#303133)
|
|
89
|
+
* @property {String | Number} title-size 标题字体大小,单位rpx(默认30)
|
|
90
|
+
* @property {String} sub-title 头部右边的副标题
|
|
91
|
+
* @property {String} sub-title-color 副标题颜色(默认#909399)
|
|
92
|
+
* @property {String | Number} sub-title-size 副标题字体大小(默认26)
|
|
93
|
+
* @property {Boolean} border 是否显示边框(默认true)
|
|
94
|
+
* @property {String | Number} index 用于标识点击了第几个卡片
|
|
95
|
+
* @property {String} box-shadow 卡片外围阴影,字符串形式(默认none)
|
|
96
|
+
* @property {String} margin 卡片与屏幕两边和上下元素的间距,需带单位,如"30rpx 20rpx"(默认30rpx)
|
|
97
|
+
* @property {String | Number} border-radius 卡片整体的圆角值,单位rpx(默认16)
|
|
98
|
+
* @property {Object} head-style 头部自定义样式,对象形式
|
|
99
|
+
* @property {Object} body-style 中部自定义样式,对象形式
|
|
100
|
+
* @property {Object} foot-style 底部自定义样式,对象形式
|
|
101
|
+
* @property {Boolean} head-border-bottom 是否显示头部的下边框(默认true)
|
|
102
|
+
* @property {Boolean} foot-border-top 是否显示底部的上边框(默认true)
|
|
103
|
+
* @property {Boolean} show-head 是否显示头部(默认true)
|
|
104
|
+
* @property {Boolean} show-foot 是否显示尾部(默认true)
|
|
105
|
+
* @property {String} thumb 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径
|
|
106
|
+
* @property {String | Number} thumb-width 缩略图的宽度,高等于宽,单位rpx(默认60)
|
|
107
|
+
* @property {Boolean} thumb-circle 缩略图是否为圆形(默认false)
|
|
108
|
+
* @event {Function} click 整个卡片任意位置被点击时触发
|
|
109
|
+
* @event {Function} head-click 卡片头部被点击时触发
|
|
110
|
+
* @event {Function} body-click 卡片主体部分被点击时触发
|
|
111
|
+
* @event {Function} foot-click 卡片底部部分被点击时触发
|
|
112
|
+
* @example <u-card padding="30" title="card"></u-card>
|
|
113
|
+
*/
|
|
114
|
+
const props = defineProps({
|
|
115
|
+
/** 与屏幕两侧是否留空隙 */
|
|
116
|
+
full: { type: Boolean, default: false },
|
|
117
|
+
/** 标题 */
|
|
118
|
+
title: { type: String, default: '' },
|
|
119
|
+
/** 标题颜色 */
|
|
120
|
+
titleColor: { type: String, default: '#303133' },
|
|
121
|
+
/** 标题字体大小,单位rpx */
|
|
122
|
+
titleSize: { type: [Number, String], default: '30' },
|
|
123
|
+
/** 副标题 */
|
|
124
|
+
subTitle: { type: String, default: '' },
|
|
125
|
+
/** 副标题颜色 */
|
|
126
|
+
subTitleColor: { type: String, default: '#909399' },
|
|
127
|
+
/** 副标题字体大小,单位rpx */
|
|
128
|
+
subTitleSize: { type: [Number, String], default: '26' },
|
|
129
|
+
/** 是否显示外部边框,只对full=false时有效(卡片与边框有空隙时) */
|
|
130
|
+
border: { type: Boolean, default: true },
|
|
131
|
+
/** 用于标识点击了第几个 */
|
|
132
|
+
index: { type: [Number, String, Object], default: '' },
|
|
133
|
+
/** 用于隔开上下左右的边距,带单位的写法,如:"30rpx 30rpx","20rpx 20rpx 30rpx 30rpx" */
|
|
134
|
+
margin: { type: String, default: '30rpx' },
|
|
135
|
+
/** card卡片的圆角 */
|
|
136
|
+
borderRadius: { type: [Number, String], default: '16' },
|
|
137
|
+
/** 头部自定义样式,对象形式 */
|
|
138
|
+
headStyle: { type: Object, default: () => ({}) },
|
|
139
|
+
/** 主体自定义样式,对象形式 */
|
|
140
|
+
bodyStyle: { type: Object, default: () => ({}) },
|
|
141
|
+
/** 底部自定义样式,对象形式 */
|
|
142
|
+
footStyle: { type: Object, default: () => ({}) },
|
|
143
|
+
/** 头部是否下边框 */
|
|
144
|
+
headBorderBottom: { type: Boolean, default: true },
|
|
145
|
+
/** 底部是否有上边框 */
|
|
146
|
+
footBorderTop: { type: Boolean, default: true },
|
|
147
|
+
/** 标题左边的缩略图 */
|
|
148
|
+
thumb: { type: String, default: '' },
|
|
149
|
+
/** 缩略图宽高,单位rpx */
|
|
150
|
+
thumbWidth: { type: [String, Number], default: '60' },
|
|
151
|
+
/** 缩略图是否为圆形 */
|
|
152
|
+
thumbCircle: { type: Boolean, default: false },
|
|
153
|
+
/** 给head,body,foot的内边距 */
|
|
154
|
+
padding: { type: [String, Number], default: '30' },
|
|
155
|
+
/** 是否显示头部 */
|
|
156
|
+
showHead: { type: Boolean, default: true },
|
|
157
|
+
/** 是否显示尾部 */
|
|
158
|
+
showFoot: { type: Boolean, default: true },
|
|
159
|
+
/** 卡片外围阴影,字符串形式 */
|
|
160
|
+
boxShadow: { type: String, default: 'none' }
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const emit = defineEmits(['click', 'head-click', 'body-click', 'foot-click']);
|
|
164
|
+
const slots = useSlots();
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 整个卡片任意位置被点击时触发
|
|
168
|
+
*/
|
|
169
|
+
function onClick() {
|
|
170
|
+
emit('click', props.index);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 卡片头部被点击时触发
|
|
174
|
+
*/
|
|
175
|
+
function onHeadClick() {
|
|
176
|
+
emit('head-click', props.index);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 卡片主体部分被点击时触发
|
|
180
|
+
*/
|
|
181
|
+
function onBodyClick() {
|
|
182
|
+
emit('body-click', props.index);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 卡片底部部分被点击时触发
|
|
186
|
+
*/
|
|
187
|
+
function onFootClick() {
|
|
188
|
+
emit('foot-click', props.index);
|
|
189
|
+
}
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<style lang="scss" scoped>
|
|
193
|
+
@import '../../libs/css/style.components.scss';
|
|
194
|
+
|
|
195
|
+
.u-card {
|
|
196
|
+
position: relative;
|
|
197
|
+
overflow: hidden;
|
|
198
|
+
font-size: 28rpx;
|
|
199
|
+
background-color: #ffffff;
|
|
200
|
+
box-sizing: border-box;
|
|
201
|
+
|
|
202
|
+
&-full {
|
|
203
|
+
// 如果是与屏幕之间不留空隙,应该设置左右边距为0
|
|
204
|
+
margin-left: 0 !important;
|
|
205
|
+
margin-right: 0 !important;
|
|
206
|
+
width: 100%;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&--border:after {
|
|
210
|
+
border-radius: 16rpx;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&__head {
|
|
214
|
+
&--left {
|
|
215
|
+
color: $u-main-color;
|
|
216
|
+
|
|
217
|
+
&__thumb {
|
|
218
|
+
margin-right: 16rpx;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
&__title {
|
|
222
|
+
max-width: 400rpx;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&--right {
|
|
227
|
+
color: $u-tips-color;
|
|
228
|
+
margin-left: 6rpx;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&__body {
|
|
233
|
+
color: $u-content-color;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&__foot {
|
|
237
|
+
color: $u-tips-color;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-cell-box">
|
|
3
|
+
<view class="u-cell-title" v-if="title" :style="[titleStyle]">
|
|
4
|
+
{{ title }}
|
|
5
|
+
</view>
|
|
6
|
+
<view class="u-cell-item-box" :class="{ 'u-border-bottom u-border-top': border }">
|
|
7
|
+
<slot />
|
|
8
|
+
</view>
|
|
9
|
+
</view>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
defineOptions({
|
|
14
|
+
name: 'u-cell-group'
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* cellGroup 单元格父组件Group
|
|
19
|
+
* @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。搭配u-cell-item
|
|
20
|
+
* @tutorial https://www.uviewui.com/components/cell.html
|
|
21
|
+
* @property {String} title 分组标题
|
|
22
|
+
* @property {Boolean} border 是否显示外边框(默认true)
|
|
23
|
+
* @property {Object} title-style 分组标题的的样式,对象形式,如{'font-size': '24rpx'} 或 {'fontSize': '24rpx'}
|
|
24
|
+
* @example <u-cell-group title="设置喜好">
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
defineProps({
|
|
28
|
+
/** 分组标题 */
|
|
29
|
+
title: { type: String, default: '' },
|
|
30
|
+
/** 是否显示分组list上下边框 */
|
|
31
|
+
border: { type: Boolean, default: true },
|
|
32
|
+
/** 分组标题的样式,对象形式,注意驼峰属性写法 */
|
|
33
|
+
/** 类似 {'font-size': '24rpx'} 和 {'fontSize': '24rpx'} */
|
|
34
|
+
titleStyle: { type: Object as () => Record<string, any>, default: () => ({}) }
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style lang="scss" scoped>
|
|
39
|
+
@import '../../libs/css/style.components.scss';
|
|
40
|
+
|
|
41
|
+
.u-cell-box {
|
|
42
|
+
width: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.u-cell-title {
|
|
46
|
+
padding: 30rpx 32rpx 10rpx 32rpx;
|
|
47
|
+
font-size: 30rpx;
|
|
48
|
+
text-align: left;
|
|
49
|
+
color: $u-tips-color;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.u-cell-item-box {
|
|
53
|
+
background-color: #ffffff;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
}
|
|
56
|
+
</style>
|