@fredwsw/frontend-rules 1.0.0
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 +302 -0
- package/bin/cli.js +155 -0
- package/package.json +22 -0
- package/template/docs/uv-ui-docs/action-sheet-cn.md +180 -0
- package/template/docs/uv-ui-docs/album-cn.md +104 -0
- package/template/docs/uv-ui-docs/alert-cn.md +71 -0
- package/template/docs/uv-ui-docs/avatar-cn.md +149 -0
- package/template/docs/uv-ui-docs/back-top-cn.md +121 -0
- package/template/docs/uv-ui-docs/badge-cn.md +100 -0
- package/template/docs/uv-ui-docs/button-cn.md +181 -0
- package/template/docs/uv-ui-docs/calendar-cn.md +179 -0
- package/template/docs/uv-ui-docs/calendars-cn.md +264 -0
- package/template/docs/uv-ui-docs/cell-cn.md +163 -0
- package/template/docs/uv-ui-docs/checkbox-cn.md +164 -0
- package/template/docs/uv-ui-docs/code-cn.md +122 -0
- package/template/docs/uv-ui-docs/code-input-cn.md +127 -0
- package/template/docs/uv-ui-docs/collapse-cn.md +206 -0
- package/template/docs/uv-ui-docs/color-cn.md +122 -0
- package/template/docs/uv-ui-docs/count-down-cn.md +169 -0
- package/template/docs/uv-ui-docs/count-to-cn.md +125 -0
- package/template/docs/uv-ui-docs/datetime-picker-cn.md +167 -0
- package/template/docs/uv-ui-docs/divider-cn.md +90 -0
- package/template/docs/uv-ui-docs/drop-down-cn.md +287 -0
- package/template/docs/uv-ui-docs/empty-cn.md +76 -0
- package/template/docs/uv-ui-docs/form-cn.md +220 -0
- package/template/docs/uv-ui-docs/gap-cn.md +63 -0
- package/template/docs/uv-ui-docs/grid-cn.md +187 -0
- package/template/docs/uv-ui-docs/icon-cn.md +255 -0
- package/template/docs/uv-ui-docs/image-cn.md +170 -0
- package/template/docs/uv-ui-docs/index-list-cn.md +132 -0
- package/template/docs/uv-ui-docs/input-cn.md +157 -0
- package/template/docs/uv-ui-docs/keyboard-cn.md +156 -0
- package/template/docs/uv-ui-docs/layout-cn.md +215 -0
- package/template/docs/uv-ui-docs/line-cn.md +77 -0
- package/template/docs/uv-ui-docs/line-progress-cn.md +132 -0
- package/template/docs/uv-ui-docs/link-cn.md +97 -0
- package/template/docs/uv-ui-docs/list-cn.md +185 -0
- package/template/docs/uv-ui-docs/load-more-cn.md +144 -0
- package/template/docs/uv-ui-docs/loading-icon-cn.md +125 -0
- package/template/docs/uv-ui-docs/loading-page-cn.md +85 -0
- package/template/docs/uv-ui-docs/modal-cn.md +212 -0
- package/template/docs/uv-ui-docs/navbar-cn.md +171 -0
- package/template/docs/uv-ui-docs/no-network-cn.md +112 -0
- package/template/docs/uv-ui-docs/notice-bar-cn.md +119 -0
- package/template/docs/uv-ui-docs/notify-cn.md +185 -0
- package/template/docs/uv-ui-docs/number-box-cn.md +131 -0
- package/template/docs/uv-ui-docs/overlay-cn.md +122 -0
- package/template/docs/uv-ui-docs/parse-cn.md +177 -0
- package/template/docs/uv-ui-docs/pick-color-cn.md +147 -0
- package/template/docs/uv-ui-docs/picker-cn.md +159 -0
- package/template/docs/uv-ui-docs/popup-cn.md +184 -0
- package/template/docs/uv-ui-docs/qrcode-cn.md +150 -0
- package/template/docs/uv-ui-docs/radio-cn.md +166 -0
- package/template/docs/uv-ui-docs/rate-cn.md +91 -0
- package/template/docs/uv-ui-docs/read-more-cn.md +191 -0
- package/template/docs/uv-ui-docs/scroll-list-cn.md +188 -0
- package/template/docs/uv-ui-docs/search-cn.md +107 -0
- package/template/docs/uv-ui-docs/skeleton-cn.md +101 -0
- package/template/docs/uv-ui-docs/skeletons-cn.md +312 -0
- package/template/docs/uv-ui-docs/slider-cn.md +98 -0
- package/template/docs/uv-ui-docs/steps-cn.md +158 -0
- package/template/docs/uv-ui-docs/sticky-cn.md +82 -0
- package/template/docs/uv-ui-docs/subsection-cn.md +161 -0
- package/template/docs/uv-ui-docs/swipe-action-cn.md +207 -0
- package/template/docs/uv-ui-docs/swiper-cn.md +247 -0
- package/template/docs/uv-ui-docs/switch-cn.md +136 -0
- package/template/docs/uv-ui-docs/tabbar-cn.md +224 -0
- package/template/docs/uv-ui-docs/tabs-cn.md +260 -0
- package/template/docs/uv-ui-docs/tags-cn.md +191 -0
- package/template/docs/uv-ui-docs/text-cn.md +178 -0
- package/template/docs/uv-ui-docs/textarea-cn.md +132 -0
- package/template/docs/uv-ui-docs/toast-cn.md +110 -0
- package/template/docs/uv-ui-docs/tooltip-cn.md +91 -0
- package/template/docs/uv-ui-docs/transition-cn.md +202 -0
- package/template/docs/uv-ui-docs/upload-cn.md +156 -0
- package/template/docs/uv-ui-docs/vtabs-cn.md +190 -0
- package/template/docs/uv-ui-docs/waterfall-cn.md +276 -0
- package/template/rules/common.mdc +90 -0
- package/template/rules/uv-ui-docs.mdc +111 -0
- package/template/skills/code-simplifier/SKILL.md +109 -0
- package/template/skills/frontend-design/SKILL.md +44 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
group: 基础
|
|
3
|
+
category: Components
|
|
4
|
+
title: Icon
|
|
5
|
+
subtitle: 图标
|
|
6
|
+
description: 基于字体的图标集,支持自定义图标与图片图标。
|
|
7
|
+
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*BD2JSKm8I-kAAAAAAAAAAAAADrJ8AQ/original
|
|
8
|
+
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*r29rQ51bNdwAAAAAAAAAAAAADrJ8AQ/original
|
|
9
|
+
demo:
|
|
10
|
+
cols: 2
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 何时使用 {#when-to-use}
|
|
14
|
+
|
|
15
|
+
基于字体的图标集,覆盖多数常见场景,开箱即用。无需为每个图标单独写样式,简单配置即可。也支持自定义图标库与「图片图标」。
|
|
16
|
+
|
|
17
|
+
> 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
18
|
+
|
|
19
|
+
## 平台兼容性 {#platform}
|
|
20
|
+
|
|
21
|
+
| App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
|
|
22
|
+
| --- | --- | --- | --- | --- | --- |
|
|
23
|
+
| √ | √ | √ | √ | √ | √ |
|
|
24
|
+
|
|
25
|
+
**组件名:** `uv-icon`
|
|
26
|
+
|
|
27
|
+
## 代码演示 {#examples}
|
|
28
|
+
|
|
29
|
+
### 基本使用 {#basic}
|
|
30
|
+
|
|
31
|
+
通过 `<uv-icon>` 使用,设置 `name` 为图标名即可。`color` 默认 `#606266`,`size` 默认 `16px`。
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<uv-icon name="photo"></uv-icon>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 修改样式 {#style}
|
|
38
|
+
|
|
39
|
+
- `color`:图标颜色
|
|
40
|
+
- `size`:图标大小(单位 px,组件也支持 rpx)
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<uv-icon name="photo" color="#2979ff" size="28"></uv-icon>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 图片图标 {#image-icon}
|
|
47
|
+
|
|
48
|
+
这里的「图片图标」指小尺寸的 icon(通常为 png 正方形),用于替代字体图标,不是大图展示场景。
|
|
49
|
+
|
|
50
|
+
- `name` 传入 **带 `/` 的链接** 或 **base64 图片** 时,会按图片图标渲染
|
|
51
|
+
- `size` 会作为图片宽度(此时 `color` 等字体相关参数无效)
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<!-- 在线地址 -->
|
|
55
|
+
<uv-icon size="40" name="https://via.placeholder.com/50x50.png/3c9cff/fff"></uv-icon>
|
|
56
|
+
<!-- base64 地址(示意) -->
|
|
57
|
+
<uv-icon size="40" name="data:image/png;base64,..."></uv-icon>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 自定义图标 {#custom}
|
|
61
|
+
|
|
62
|
+
自定义字体图标库时,通过 `customPrefix` 指定前缀(注意:**nvue 暂不支持**)。
|
|
63
|
+
|
|
64
|
+
## API {#api}
|
|
65
|
+
|
|
66
|
+
### Icon Props {#props}
|
|
67
|
+
|
|
68
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| name | String | - | 图标名称;若包含 `/` 或符合 base64 图片格式,则按图片图标渲染 |
|
|
71
|
+
| color | String | #606266 | 图标颜色;也可传主题色名(如 `primary`) |
|
|
72
|
+
| size | String \| Number | 16px | 图标大小,单位 px(或 rpx) |
|
|
73
|
+
| bold | Boolean | false | 是否加粗 |
|
|
74
|
+
| index | String \| Number | - | 区分多个图标的值,点击时会在事件中带出 |
|
|
75
|
+
| hoverClass | String | - | 按下样式类,用法同 uni 的 `hover-class` |
|
|
76
|
+
| customPrefix | String | uvicon | 自定义字体图标库前缀(nvue 暂不支持) |
|
|
77
|
+
| label | String \| Number | - | 图标右侧/下方的文字 |
|
|
78
|
+
| labelPos | String | right | label 位置:right \| bottom \| top \| left |
|
|
79
|
+
| labelSize | String \| Number | 15px | label 字号 |
|
|
80
|
+
| labelColor | String | #606266 | label 颜色 |
|
|
81
|
+
| space | String \| Number | 3px | label 与图标间距,单位 px(或 rpx) |
|
|
82
|
+
| imgMode | String | - | 图片裁剪/缩放模式(同 image 原生属性) |
|
|
83
|
+
| width | String \| Number | - | 图片图标宽度,单位 px(或 rpx) |
|
|
84
|
+
| height | String \| Number | - | 图片图标高度,单位 px(或 rpx) |
|
|
85
|
+
| top | String \| Number | 0 | 图标到顶部距离,用于微调垂直居中,单位 px(或 rpx) |
|
|
86
|
+
| stop | Boolean | false | 是否阻止事件传播 |
|
|
87
|
+
|
|
88
|
+
### Icon Events {#events}
|
|
89
|
+
|
|
90
|
+
| 事件名 | 说明 | 回调参数 |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| @click | 点击图标时触发 | `index`:props 传入的 index 值 |
|
|
93
|
+
|
|
94
|
+
## 图标集 {#icons}
|
|
95
|
+
|
|
96
|
+
以下为内置图标名(`name` 可用值)。如需更多或自定义,请使用自定义图标库扩展。
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
level
|
|
100
|
+
woman
|
|
101
|
+
man
|
|
102
|
+
chat
|
|
103
|
+
chat-fill
|
|
104
|
+
red-packet
|
|
105
|
+
order
|
|
106
|
+
folder
|
|
107
|
+
arrow-up-fill
|
|
108
|
+
arrow-down-fill
|
|
109
|
+
backspace
|
|
110
|
+
photo
|
|
111
|
+
photo-fill
|
|
112
|
+
lock
|
|
113
|
+
lock-fill
|
|
114
|
+
lock-open
|
|
115
|
+
lock-opened-fill
|
|
116
|
+
home
|
|
117
|
+
home-fill
|
|
118
|
+
star
|
|
119
|
+
star-fill
|
|
120
|
+
share
|
|
121
|
+
share-fill
|
|
122
|
+
share-square
|
|
123
|
+
volume
|
|
124
|
+
volume-fill
|
|
125
|
+
volume-off
|
|
126
|
+
volume-off-fill
|
|
127
|
+
trash
|
|
128
|
+
trash-fill
|
|
129
|
+
shopping-cart
|
|
130
|
+
shopping-cart-fill
|
|
131
|
+
question-circle
|
|
132
|
+
question-circle-fill
|
|
133
|
+
plus
|
|
134
|
+
plus-circle
|
|
135
|
+
plus-circle-fill
|
|
136
|
+
tags
|
|
137
|
+
tags-fill
|
|
138
|
+
pause
|
|
139
|
+
pause-circle
|
|
140
|
+
pause-circle-fill
|
|
141
|
+
play-circle
|
|
142
|
+
play-circle-fill
|
|
143
|
+
map
|
|
144
|
+
map-fill
|
|
145
|
+
phone
|
|
146
|
+
phone-fill
|
|
147
|
+
list
|
|
148
|
+
list-dot
|
|
149
|
+
info-circle
|
|
150
|
+
info-circle-fill
|
|
151
|
+
minus
|
|
152
|
+
minus-circle
|
|
153
|
+
mic
|
|
154
|
+
mic-off
|
|
155
|
+
grid
|
|
156
|
+
grid-fill
|
|
157
|
+
eye
|
|
158
|
+
eye-fill
|
|
159
|
+
eye-off
|
|
160
|
+
eye-off-outline
|
|
161
|
+
file-text
|
|
162
|
+
file-text-fill
|
|
163
|
+
edit-pen
|
|
164
|
+
edit-pen-fill
|
|
165
|
+
email
|
|
166
|
+
email-fill
|
|
167
|
+
download
|
|
168
|
+
checkmark
|
|
169
|
+
checkmark-circle
|
|
170
|
+
checkmark-circle-fill
|
|
171
|
+
checkbox-mark
|
|
172
|
+
clock
|
|
173
|
+
clock-fill
|
|
174
|
+
close
|
|
175
|
+
close-circle
|
|
176
|
+
close-circle-fill
|
|
177
|
+
calendar
|
|
178
|
+
car
|
|
179
|
+
car-fill
|
|
180
|
+
bell
|
|
181
|
+
bell-fill
|
|
182
|
+
attach
|
|
183
|
+
play-right
|
|
184
|
+
play-right-fill
|
|
185
|
+
play-left
|
|
186
|
+
play-left-fill
|
|
187
|
+
error-circle
|
|
188
|
+
error-circle-fill
|
|
189
|
+
skip-back-left
|
|
190
|
+
skip-forward-right
|
|
191
|
+
search
|
|
192
|
+
setting
|
|
193
|
+
setting-fill
|
|
194
|
+
more-dot-fill
|
|
195
|
+
more-circle
|
|
196
|
+
more-circle-fill
|
|
197
|
+
bag
|
|
198
|
+
arrow-upward
|
|
199
|
+
arrow-downward
|
|
200
|
+
arrow-leftward
|
|
201
|
+
arrow-rightward
|
|
202
|
+
arrow-up
|
|
203
|
+
arrow-down
|
|
204
|
+
arrow-left
|
|
205
|
+
arrow-right
|
|
206
|
+
thumb-up
|
|
207
|
+
thumb-up-fill
|
|
208
|
+
thumb-down
|
|
209
|
+
thumb-down-fill
|
|
210
|
+
coupon
|
|
211
|
+
coupon-fill
|
|
212
|
+
kefu-ermai
|
|
213
|
+
server-fill
|
|
214
|
+
server-man
|
|
215
|
+
scan
|
|
216
|
+
warning
|
|
217
|
+
warning-fill
|
|
218
|
+
apple-fill
|
|
219
|
+
camera
|
|
220
|
+
camera-fill
|
|
221
|
+
pushpin
|
|
222
|
+
pushpin-fill
|
|
223
|
+
heart
|
|
224
|
+
heart-fill
|
|
225
|
+
reload
|
|
226
|
+
account
|
|
227
|
+
account-fill
|
|
228
|
+
integral
|
|
229
|
+
integral-fill
|
|
230
|
+
gift
|
|
231
|
+
gift-fill
|
|
232
|
+
zhifubao-circle-fill
|
|
233
|
+
weixin-fill
|
|
234
|
+
weixin-circle-fill
|
|
235
|
+
twitter-circle-fill
|
|
236
|
+
qq-fill
|
|
237
|
+
qq-circle-fill
|
|
238
|
+
moments
|
|
239
|
+
moments-circel-fill
|
|
240
|
+
twitte
|
|
241
|
+
empty-data
|
|
242
|
+
empty-address
|
|
243
|
+
empty-favor
|
|
244
|
+
empty-car
|
|
245
|
+
empty-order
|
|
246
|
+
empty-list
|
|
247
|
+
empty-search
|
|
248
|
+
empty-permission
|
|
249
|
+
empty-news
|
|
250
|
+
empty-history
|
|
251
|
+
empty-coupon
|
|
252
|
+
empty-page
|
|
253
|
+
wifi-off
|
|
254
|
+
```
|
|
255
|
+
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
group: 基础
|
|
3
|
+
category: Components
|
|
4
|
+
title: Image
|
|
5
|
+
subtitle: 图片
|
|
6
|
+
description: 增强版图片组件,支持懒加载、加载中/失败提示、淡入动画与圆角形状等。
|
|
7
|
+
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*BD2JSKm8I-kAAAAAAAAAAAAADrJ8AQ/original
|
|
8
|
+
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*r29rQ51bNdwAAAAAAAAAAAAADrJ8AQ/original
|
|
9
|
+
demo:
|
|
10
|
+
cols: 2
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 何时使用 {#when-to-use}
|
|
14
|
+
|
|
15
|
+
`uv-image` 是 uni-app `image` 的增强版,在继承原有能力基础上提供:
|
|
16
|
+
|
|
17
|
+
- 淡入动画
|
|
18
|
+
- 加载中提示
|
|
19
|
+
- 加载失败提示
|
|
20
|
+
- 圆角与形状控制
|
|
21
|
+
- 多种懒加载策略(官方 lazyLoad + observer 懒加载)
|
|
22
|
+
|
|
23
|
+
推荐在大部分图片场景优先使用 `uv-image`。
|
|
24
|
+
|
|
25
|
+
> 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
26
|
+
|
|
27
|
+
## 平台兼容性 {#platform}
|
|
28
|
+
|
|
29
|
+
| App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
|
|
30
|
+
| --- | --- | --- | --- | --- | --- |
|
|
31
|
+
| √ | √ | √ | √ | √ | √ |
|
|
32
|
+
|
|
33
|
+
**组件名:** `uv-image`
|
|
34
|
+
|
|
35
|
+
## 代码演示 {#examples}
|
|
36
|
+
|
|
37
|
+
### 基本使用 {#basic}
|
|
38
|
+
|
|
39
|
+
配置图片的 `width`、`height` 和 `src` 即可。
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<template>
|
|
43
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" width="80px" height="80px"></uv-image>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 图片裁剪、缩放模式 {#mode}
|
|
48
|
+
|
|
49
|
+
通过 `mode` 配置填充模式,与 uni-app `image` 的 `mode` 参数完全一致(如 `widthFix` 等)。
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" mode="widthFix"></uv-image>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 图片形状 {#shape}
|
|
56
|
+
|
|
57
|
+
- `shape`:`circle` 圆形,`square` 方形
|
|
58
|
+
- 当 `shape="square"` 时,可通过 `radius` 设置圆角
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" shape="circle"></uv-image>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 懒加载(官方 lazyLoad) {#lazy-load}
|
|
65
|
+
|
|
66
|
+
`lazyLoad` 仅对 **微信小程序、App、百度小程序、字节跳动小程序** 有效,且只对 `page` 与 `scroll-view` 下的图片生效。默认开启。
|
|
67
|
+
|
|
68
|
+
```vue
|
|
69
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" :lazy-load="true"></uv-image>
|
|
70
|
+
``>
|
|
71
|
+
|
|
72
|
+
### observer 懒加载 {#observer}
|
|
73
|
+
|
|
74
|
+
设置 `observeLazyLoad` 为 `true` 开启 observer 懒加载:图片滑动到可视范围内时才会请求加载。
|
|
75
|
+
|
|
76
|
+
> 注意:nvue 页面不生效,因为 nvue 不支持 `uni.createIntersectionObserver()`。
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" :observeLazyLoad="true"></uv-image>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 加载中提示 {#loading-slot}
|
|
83
|
+
|
|
84
|
+
图片加载过程中默认为「加载中」状态(内置小图标)。可通过 `loading` 插槽自定义内容,常配合 `uv-loading-icon`。
|
|
85
|
+
|
|
86
|
+
```vue
|
|
87
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg">
|
|
88
|
+
<template v-slot:loading>
|
|
89
|
+
<uv-loading-icon color="red"></uv-loading-icon>
|
|
90
|
+
</template>
|
|
91
|
+
</uv-image>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 加载错误提示 {#error-slot}
|
|
95
|
+
|
|
96
|
+
加载失败时默认显示错误图标。可通过 `error` 插槽自定义。
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg">
|
|
100
|
+
<template v-slot:error>
|
|
101
|
+
<view style="font-size: 24rpx;">加载失败</view>
|
|
102
|
+
</template>
|
|
103
|
+
</uv-image>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 淡入动画 {#fade}
|
|
107
|
+
|
|
108
|
+
组件自带加载完成时的淡入动画:
|
|
109
|
+
|
|
110
|
+
- `fade`:是否启用淡入
|
|
111
|
+
- `duration`:过渡时间(ms)
|
|
112
|
+
|
|
113
|
+
```vue
|
|
114
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" :fade="true" duration="450"></uv-image>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 事件冒泡 {#bubble}
|
|
118
|
+
|
|
119
|
+
默认允许事件冒泡(常见需求:点击图片触发父级点击)。若要阻止冒泡,可在外层包裹 `view` 并使用 `@tap.stop`。
|
|
120
|
+
|
|
121
|
+
```vue
|
|
122
|
+
<!-- 点击图片将不会触发 clickHandler -->
|
|
123
|
+
<view @tap="clickHandler">
|
|
124
|
+
<view @tap.stop>
|
|
125
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg"></uv-image>
|
|
126
|
+
</view>
|
|
127
|
+
</view>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## API {#api}
|
|
131
|
+
|
|
132
|
+
### Image Props {#props}
|
|
133
|
+
|
|
134
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
135
|
+
| --- | --- | --- | --- |
|
|
136
|
+
| src | String | - | 图片地址,强烈建议使用绝对或网络路径 |
|
|
137
|
+
| mode | String | aspectFill | 裁剪模式,同 uni-app `image` 的 `mode` |
|
|
138
|
+
| width | String \| Number | 300 | 宽度(任意单位;数值默认 px/rpx) |
|
|
139
|
+
| height | String \| Number | 225 | 高度(任意单位;数值默认 px/rpx) |
|
|
140
|
+
| shape | String | square | 图片形状:circle 圆形、square 方形 |
|
|
141
|
+
| radius | String \| Number | 0 | 圆角(默认单位 px) |
|
|
142
|
+
| lazyLoad | Boolean | true \| false | 是否使用原生懒加载(微信/APP/百度/字节小程序) |
|
|
143
|
+
| observeLazyLoad | Boolean | false | 是否开启 observer 懒加载(nvue 无效) |
|
|
144
|
+
| showMenuByLongpress | Boolean | true | 是否开启长按识别小程序码菜单(仅微信小程序) |
|
|
145
|
+
| loadingIcon | String | photo | 加载中图标或小图片名 |
|
|
146
|
+
| errorIcon | String | error-circle | 加载失败图标或小图片名 |
|
|
147
|
+
| showLoading | Boolean | true | 是否显示加载中图标或 loading 插槽 |
|
|
148
|
+
| showError | Boolean | true | 是否显示加载失败图标或 error 插槽 |
|
|
149
|
+
| fade | Boolean | true | 是否启用淡入效果 |
|
|
150
|
+
| webp | Boolean | false | 仅网络资源,且只对微信小程序有效 |
|
|
151
|
+
| duration | String \| Number | 500 | 搭配 fade 的过渡时间(ms) |
|
|
152
|
+
| bgColor | String | #f3f4f6 | 背景色(用于深色背景中更好过渡) |
|
|
153
|
+
| cellChild | Boolean | false | 是否属于 cell 节点下(nvue 在 cell/uv-list 下建议设为 true,避免回收后不显示) |
|
|
154
|
+
| customStyle | Object | - | 自定义样式 |
|
|
155
|
+
|
|
156
|
+
### Image Slots {#slots}
|
|
157
|
+
|
|
158
|
+
| 名称 | 说明 |
|
|
159
|
+
| --- | --- |
|
|
160
|
+
| loading | 自定义加载中的提示内容 |
|
|
161
|
+
| error | 自定义加载失败的提示内容 |
|
|
162
|
+
|
|
163
|
+
### Image Events {#events}
|
|
164
|
+
|
|
165
|
+
| 事件名 | 说明 | 回调参数 |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| @click | 点击图片时触发 | - |
|
|
168
|
+
| @error | 图片加载失败时触发 | `err`:错误信息 |
|
|
169
|
+
| @load | 图片加载成功时触发 | - |
|
|
170
|
+
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
group: 数据
|
|
3
|
+
category: Components
|
|
4
|
+
title: IndexList
|
|
5
|
+
subtitle: 索引列表
|
|
6
|
+
description: 右侧带索引的长列表,支持锚点吸顶与快速定位,常用于城市/机场选择等场景。
|
|
7
|
+
demo:
|
|
8
|
+
cols: 2
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 何时使用 {#when-to-use}
|
|
12
|
+
|
|
13
|
+
`uv-index-list` 用于展示带索引锚点的列表,右侧索引可快速定位到对应分组,适用于城市列表、通讯录等场景。
|
|
14
|
+
|
|
15
|
+
> 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
16
|
+
|
|
17
|
+
## 平台兼容性 {#platform}
|
|
18
|
+
|
|
19
|
+
| App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
|
|
20
|
+
| --- | --- | --- | --- | --- | --- |
|
|
21
|
+
| √ | √ | √ | √ | √ | √ |
|
|
22
|
+
|
|
23
|
+
**组件名:** `uv-index-list`、`uv-index-item`、`uv-index-anchor`
|
|
24
|
+
|
|
25
|
+
## 代码演示 {#examples}
|
|
26
|
+
|
|
27
|
+
### 基本使用 {#basic}
|
|
28
|
+
|
|
29
|
+
外层包裹 `uv-index-list`,锚点通过 `uv-index-anchor` 传入,自定义列表内容通过 `uv-index-item` 嵌套使用。
|
|
30
|
+
|
|
31
|
+
- nvue:需要将 `uv-index-anchor` 写在 `uv-index-item` 外部
|
|
32
|
+
- 非 nvue:需要将 `uv-index-anchor` 嵌套在 `uv-index-item` 内部
|
|
33
|
+
- 可通过 `index-list` 参数自定义索引字符列表
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<template>
|
|
37
|
+
<view>
|
|
38
|
+
<view style="height: 100rpx;width: 750rpx;background-color: pink;">自定义头部</view>
|
|
39
|
+
<uv-index-list :index-list="indexList" customNavHeight="100rpx">
|
|
40
|
+
<template v-slot:header>
|
|
41
|
+
<view style="height: 100rpx;width: 750rpx;background-color: #3c9cff;">头部内容</view>
|
|
42
|
+
</template>
|
|
43
|
+
<template v-for="(item, index) in itemArr">
|
|
44
|
+
<!-- #ifdef APP-NVUE -->
|
|
45
|
+
<uv-index-anchor :text="indexList[index]"></uv-index-anchor>
|
|
46
|
+
<!-- #endif -->
|
|
47
|
+
<uv-index-item>
|
|
48
|
+
<!-- #ifndef APP-NVUE -->
|
|
49
|
+
<uv-index-anchor :text="indexList[index]"></uv-index-anchor>
|
|
50
|
+
<!-- #endif -->
|
|
51
|
+
<view class="list-cell" v-for="(cell, index) in item">
|
|
52
|
+
{{ cell }}
|
|
53
|
+
</view>
|
|
54
|
+
</uv-index-item>
|
|
55
|
+
</template>
|
|
56
|
+
</uv-index-list>
|
|
57
|
+
</view>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
export default {
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
indexList: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
|
|
65
|
+
itemArr: [
|
|
66
|
+
['列表A1', '列表A2', '列表A3'],
|
|
67
|
+
['列表B1', '列表B2', '列表B3'],
|
|
68
|
+
['列表C1', '列表C2', '列表C3'],
|
|
69
|
+
['列表D1', '列表D2', '列表D3'],
|
|
70
|
+
['列表E1', '列表E2', '列表E3'],
|
|
71
|
+
['列表F1', '列表F2', '列表F3'],
|
|
72
|
+
['列表G1', '列表G2', '列表G3']
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style lang="scss" scoped>
|
|
80
|
+
.list-cell {
|
|
81
|
+
/* #ifndef APP-PLUS */
|
|
82
|
+
display: flex;
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
width: 100%;
|
|
85
|
+
/* #endif */
|
|
86
|
+
padding: 10px 24rpx;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
color: #323233;
|
|
89
|
+
font-size: 14px;
|
|
90
|
+
line-height: 24px;
|
|
91
|
+
background-color: #fff;
|
|
92
|
+
}
|
|
93
|
+
</style>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 自定义导航栏 {#custom-nav}
|
|
97
|
+
|
|
98
|
+
默认锚点会吸附在导航栏下方;如果取消/自定义了导航栏,需要指定吸顶高度 `custom-nav-height`(单位默认 px),通常设置为导航栏高度。
|
|
99
|
+
|
|
100
|
+
## API {#api}
|
|
101
|
+
|
|
102
|
+
### IndexList Props {#props}
|
|
103
|
+
|
|
104
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
105
|
+
| --- | --- | --- | --- | --- |
|
|
106
|
+
| inactiveColor | 右侧索引非激活时颜色 | String | #606266 | - |
|
|
107
|
+
| activeColor | 右侧索引激活时颜色 | String | #5677fc | - |
|
|
108
|
+
| indexList | 索引字符列表 | Array\<string \| number\> | A-Z | - |
|
|
109
|
+
| sticky | 是否开启锚点自动吸顶 | Boolean | true | false |
|
|
110
|
+
| customNavHeight | 自定义导航栏高度(单位默认 px) | String \| Number | 0 | - |
|
|
111
|
+
|
|
112
|
+
### IndexAnchor Props {#anchor-props}
|
|
113
|
+
|
|
114
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
115
|
+
| --- | --- | --- | --- | --- |
|
|
116
|
+
| text | 列表锚点文本内容 | String \| Number | - | - |
|
|
117
|
+
| color | 列表锚点文字颜色 | String | #606266 | - |
|
|
118
|
+
| size | 列表锚点文字大小(单位默认 px) | String \| Number | 14 | - |
|
|
119
|
+
| bgColor | 列表锚点背景颜色 | String | #dedede | - |
|
|
120
|
+
| height | 列表锚点高度(单位默认 px) | String \| Number | 32 | - |
|
|
121
|
+
|
|
122
|
+
### IndexList Events {#events}
|
|
123
|
+
|
|
124
|
+
| 事件名 | 说明 | 回调参数 |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| @select | 选中右侧索引字符时触发 | index:索引字符 |
|
|
127
|
+
|
|
128
|
+
### IndexItem Slots {#slots}
|
|
129
|
+
|
|
130
|
+
| 名称 | 说明 |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| default | 自定义列表内容 |
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
group: 表单
|
|
3
|
+
category: Components
|
|
4
|
+
title: Input
|
|
5
|
+
subtitle: 输入框
|
|
6
|
+
description: 专为 uv-form 设计的输入框,默认无边框,可快速实现表单验证、输入、下拉选择等。
|
|
7
|
+
demo:
|
|
8
|
+
cols: 2
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 何时使用 {#when-to-use}
|
|
12
|
+
|
|
13
|
+
`uv-input` 默认无边框和样式,适合在 `uv-form` 中配合 `uv-form-item` 使用,实现表单验证、输入内容、下拉选择等。
|
|
14
|
+
|
|
15
|
+
> 完整示例下载地址:[uv-ui 插件市场](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
16
|
+
|
|
17
|
+
## 平台兼容性 {#platform}
|
|
18
|
+
|
|
19
|
+
| App(vue) | App(nvue) | H5 | 小程序 | VUE2 | VUE3 |
|
|
20
|
+
| --- | --- | --- | --- | --- | --- |
|
|
21
|
+
| √ | √ | √ | √ | √ | √ |
|
|
22
|
+
|
|
23
|
+
**组件名:** `uv-input`
|
|
24
|
+
|
|
25
|
+
## 代码演示 {#examples}
|
|
26
|
+
|
|
27
|
+
### 基本使用 {#basic}
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<template>
|
|
31
|
+
<uv-input
|
|
32
|
+
placeholder="请输入内容"
|
|
33
|
+
border="surround"
|
|
34
|
+
v-model="value"
|
|
35
|
+
@change="change"
|
|
36
|
+
></uv-input>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
export default {
|
|
40
|
+
data() {
|
|
41
|
+
return { value: '' }
|
|
42
|
+
},
|
|
43
|
+
methods: {
|
|
44
|
+
change(e) {
|
|
45
|
+
console.log('change', e)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 可清空 {#clearable}
|
|
53
|
+
|
|
54
|
+
```vue
|
|
55
|
+
<uv-input placeholder="请输入内容" border="surround" clearable></uv-input>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 下划线 {#border}
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<uv-input placeholder="请输入内容" border="bottom"></uv-input>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 前后图标 {#icons}
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<uv-input
|
|
68
|
+
placeholder="前置图标"
|
|
69
|
+
prefixIcon="search"
|
|
70
|
+
prefixIconStyle="font-size: 22px;color: #909399"
|
|
71
|
+
></uv-input>
|
|
72
|
+
<uv-input
|
|
73
|
+
placeholder="后置图标"
|
|
74
|
+
suffixIcon="map-fill"
|
|
75
|
+
suffixIconStyle="color: #909399"
|
|
76
|
+
></uv-input>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 前后插槽 {#slots}
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<uv-input placeholder="前置插槽">
|
|
83
|
+
<template v-slot:prefix>
|
|
84
|
+
<uv-text text="http://" margin="0 3px 0 0" type="tips"></uv-text>
|
|
85
|
+
</template>
|
|
86
|
+
</uv-input>
|
|
87
|
+
<uv-input placeholder="后置插槽">
|
|
88
|
+
<template v-slot:suffix>
|
|
89
|
+
<uv-code ref="uCode" seconds="20" changeText="X秒重新获取"></uv-code>
|
|
90
|
+
</template>
|
|
91
|
+
</uv-input>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## API {#api}
|
|
95
|
+
|
|
96
|
+
### Input Props {#props}
|
|
97
|
+
|
|
98
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
99
|
+
| --- | --- | --- | --- | --- |
|
|
100
|
+
| value / v-model | 输入值 | Number \| String | - | - |
|
|
101
|
+
| type | 输入框类型 | String | text | text \| number \| idcard \| digit \| password |
|
|
102
|
+
| disabled | 是否禁用 | Boolean | false | true \| false |
|
|
103
|
+
| disabledColor | 禁用背景色 | String | #f5f7fa | - |
|
|
104
|
+
| clearable | 是否显示清除 | Boolean | false | true \| false |
|
|
105
|
+
| password | 是否密码类型 | Boolean | false | true \| false |
|
|
106
|
+
| maxlength | 最大长度,-1 不限制 | String \| Number | -1 | - |
|
|
107
|
+
| placeholder | 占位符 | String | - | - |
|
|
108
|
+
| placeholderClass | placeholder 样式类 | String | input-placeholder | - |
|
|
109
|
+
| placeholderStyle | placeholder 样式 | String \| Object | color: #c0c4cc | - |
|
|
110
|
+
| confirmType | 键盘右下角按钮文字 | String | done | done \| send \| search \| next \| go |
|
|
111
|
+
| confirmHold | 点击完成是否保持键盘 | Boolean | false | true \| false |
|
|
112
|
+
| holdKeyboard | focus 时点击页面不收键盘 | Boolean | false | true \| false |
|
|
113
|
+
| focus | 自动聚焦 | Boolean | false | true \| false |
|
|
114
|
+
| prefixIcon | 前置图标 | String | - | - |
|
|
115
|
+
| prefixIconStyle | 前置图标样式 | String \| Object | - | - |
|
|
116
|
+
| suffixIcon | 后置图标 | String | - | - |
|
|
117
|
+
| suffixIconStyle | 后置图标样式 | String \| Object | - | - |
|
|
118
|
+
| border | 边框类型 | String | surround | surround \| bottom \| none |
|
|
119
|
+
| readonly | 只读 | Boolean | false | true \| false |
|
|
120
|
+
| shape | 形状 | String | square | square \| circle |
|
|
121
|
+
| formatter | 格式化函数(微信小程序可用 setFormatter) | Function | null | - |
|
|
122
|
+
| customStyle | 自定义外部样式 | Object | - | - |
|
|
123
|
+
|
|
124
|
+
### Type Options {#type-options}
|
|
125
|
+
|
|
126
|
+
| 属性名 | 说明 |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| text | 文本输入 |
|
|
129
|
+
| number | 数字输入 |
|
|
130
|
+
| idcard | 身份证输入 |
|
|
131
|
+
| digit | 带小数点的数字 |
|
|
132
|
+
| password | 密码(等同 password=true) |
|
|
133
|
+
|
|
134
|
+
### Input Methods {#methods}
|
|
135
|
+
|
|
136
|
+
| 方法名 | 说明 |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| setFormatter | 兼容微信小程序,设置 formatter |
|
|
139
|
+
|
|
140
|
+
### Input Events {#events}
|
|
141
|
+
|
|
142
|
+
| 事件名 | 说明 | 回调参数 |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
| @blur | 失去焦点 | value |
|
|
145
|
+
| @focus | 聚焦 | - |
|
|
146
|
+
| @confirm | 点击完成 | value |
|
|
147
|
+
| @keyboardheightchange | 键盘高度变化 | - |
|
|
148
|
+
| @input | 内容变化 | value |
|
|
149
|
+
| @clear | 点击清空 | - |
|
|
150
|
+
| @change | 内容变化 | - |
|
|
151
|
+
|
|
152
|
+
### Input Slots {#slots}
|
|
153
|
+
|
|
154
|
+
| 名称 | 说明 |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| prefix | 前置内容 |
|
|
157
|
+
| suffix | 后置内容 |
|