@gmcb/uv-ui 0.2.27 → 0.3.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 +8 -0
- package/LICENSE +21 -0
- package/README.md +95 -141
- package/docs/api/configs/color.md +52 -0
- package/docs/api/index.md +77 -0
- package/docs/api/mixins/mpShare.md +95 -0
- package/docs/api/request/apiManage.md +88 -0
- package/docs/api/request/http.md +451 -0
- package/docs/api/utils/colorSwitch.md +78 -0
- package/docs/api/utils/debounce.md +104 -0
- package/docs/api/utils/fastUse.md +246 -0
- package/docs/api/utils/getRect.md +238 -0
- package/docs/api/utils/guid.md +41 -0
- package/docs/api/utils/index.md +55 -0
- package/docs/api/utils/intro.md +25 -0
- package/docs/api/utils/object.md +171 -0
- package/docs/api/utils/queryParams.md +68 -0
- package/docs/api/utils/random.md +23 -0
- package/docs/api/utils/randomArray.md +28 -0
- package/docs/api/utils/route.md +121 -0
- package/docs/api/utils/test.md +237 -0
- package/docs/api/utils/time.md +81 -0
- package/docs/api/utils/trim.md +24 -0
- package/docs/components/actionSheet.md +236 -0
- package/docs/components/addQQGroup.md +5 -0
- package/docs/components/album.md +91 -0
- package/docs/components/alert.md +83 -0
- package/docs/components/avatar.md +152 -0
- package/docs/components/backTop.md +181 -0
- package/docs/components/badge.md +117 -0
- package/docs/components/button.md +196 -0
- package/docs/components/calendar.md +398 -0
- package/docs/components/calendars.md +294 -0
- package/docs/components/cell.md +185 -0
- package/docs/components/checkbox.md +281 -0
- package/docs/components/circleProgress.md +5 -0
- package/docs/components/code.md +162 -0
- package/docs/components/codeInput.md +175 -0
- package/docs/components/collapse.md +250 -0
- package/docs/components/color.md +324 -0
- package/docs/components/common.md +126 -0
- package/docs/components/countDown.md +166 -0
- package/docs/components/countTo.md +140 -0
- package/docs/components/datetimePicker.md +283 -0
- package/docs/components/diff1.x.md +190 -0
- package/docs/components/divider.md +88 -0
- package/docs/components/downloadSetting.md +54 -0
- package/docs/components/dropDown.md +375 -0
- package/docs/components/empty.md +99 -0
- package/docs/components/feature.md +261 -0
- package/docs/components/form.md +736 -0
- package/docs/components/gap.md +49 -0
- package/docs/components/grid.md +225 -0
- package/docs/components/icon.md +101 -0
- package/docs/components/image.md +182 -0
- package/docs/components/index.md +110 -0
- package/docs/components/indexList.md +133 -0
- package/docs/components/input.md +250 -0
- package/docs/components/install.md +59 -0
- package/docs/components/intro.md +32 -0
- package/docs/components/keyboard.md +226 -0
- package/docs/components/layout.md +310 -0
- package/docs/components/line.md +85 -0
- package/docs/components/lineProgress.md +141 -0
- package/docs/components/link.md +89 -0
- package/docs/components/list.md +223 -0
- package/docs/components/loadMore.md +140 -0
- package/docs/components/loadingIcon.md +144 -0
- package/docs/components/loadingPage.md +92 -0
- package/docs/components/modal.md +230 -0
- package/docs/components/more.md +13 -0
- package/docs/components/navbar.md +192 -0
- package/docs/components/noNetwork.md +116 -0
- package/docs/components/noticeBar.md +131 -0
- package/docs/components/notify.md +204 -0
- package/docs/components/npmSetting.md +64 -0
- package/docs/components/numberBox.md +257 -0
- package/docs/components/nvue.md +170 -0
- package/docs/components/overlay.md +117 -0
- package/docs/components/parse.md +204 -0
- package/docs/components/pickColor.md +112 -0
- package/docs/components/picker.md +357 -0
- package/docs/components/popup.md +221 -0
- package/docs/components/problem.md +300 -0
- package/docs/components/qrcode.md +169 -0
- package/docs/components/quickstart.md +33 -0
- package/docs/components/radio.md +256 -0
- package/docs/components/rate.md +128 -0
- package/docs/components/read.md +163 -0
- package/docs/components/readMore.md +227 -0
- package/docs/components/resource.md +17 -0
- package/docs/components/scrollList.md +218 -0
- package/docs/components/search.md +160 -0
- package/docs/components/setting.md +111 -0
- package/docs/components/settingDesc.md +66 -0
- package/docs/components/skeleton.md +105 -0
- package/docs/components/skeletons.md +323 -0
- package/docs/components/slider.md +157 -0
- package/docs/components/steps.md +189 -0
- package/docs/components/sticky.md +76 -0
- package/docs/components/subsection.md +183 -0
- package/docs/components/swipeAction.md +279 -0
- package/docs/components/swiper.md +352 -0
- package/docs/components/switch.md +216 -0
- package/docs/components/tabbar.md +263 -0
- package/docs/components/table.md +5 -0
- package/docs/components/tabs.md +364 -0
- package/docs/components/tag.md +227 -0
- package/docs/components/testPic.md +20 -0
- package/docs/components/text.md +157 -0
- package/docs/components/textarea.md +121 -0
- package/docs/components/toast.md +124 -0
- package/docs/components/tooltip.md +98 -0
- package/docs/components/transition.md +404 -0
- package/docs/components/upload.md +253 -0
- package/docs/components/vtabs.md +332 -0
- package/docs/components/vueUse.md +45 -0
- package/docs/components/vuexDetail.md +103 -0
- package/docs/components/waterfall.md +651 -0
- package/docs/faq/index.md +53 -0
- package/docs/guide/codeHint.md +44 -0
- package/docs/guide/customIcon.md +168 -0
- package/docs/guide/demo.md +92 -0
- package/docs/guide/design.md +56 -0
- package/docs/guide/globalVariable.md +239 -0
- package/docs/guide/i18n.md +194 -0
- package/docs/guide/index.md +28 -0
- package/docs/guide/note.md +74 -0
- package/docs/guide/safeAreaInset.md +64 -0
- package/docs/guide/theme.md +67 -0
- package/docs/index.md +88 -0
- package/libs/config/config.js +0 -10
- package/libs/css/color.scss +15 -14
- package/package.json +7 -2
- package/theme.scss +2 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
## Gap 间隔槽 <to-api/>
|
|
2
|
+
|
|
3
|
+
<demo-model url="/pages/componentsA/gap/gap"></demo-model>
|
|
4
|
+
|
|
5
|
+
::: tip ✈
|
|
6
|
+
|
|
7
|
+
**组件名:uv-gap**
|
|
8
|
+
|
|
9
|
+
[点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-gap)
|
|
10
|
+
|
|
11
|
+
:::
|
|
12
|
+
|
|
13
|
+
该组件一般用于内容块之间的用一个灰色块隔开的场景,方便用户风格统一,减少工作量
|
|
14
|
+
|
|
15
|
+
### 平台兼容性
|
|
16
|
+
|
|
17
|
+
|App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
|
|
18
|
+
|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
19
|
+
|√|√|√|√|√|√|
|
|
20
|
+
|
|
21
|
+
### 基本使用
|
|
22
|
+
|
|
23
|
+
直接引入即可使用
|
|
24
|
+
- 通过`height`配置高度,单位`px(rpx)`
|
|
25
|
+
- 通过`bgColor`配置背景颜色
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<uv-gap height="80" bgColor="#bbb"></uv-gap>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 完整示例
|
|
32
|
+
|
|
33
|
+
::: tip 完整示例下载地址
|
|
34
|
+
|
|
35
|
+
[https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
36
|
+
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
### API
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Gap Props
|
|
43
|
+
|
|
44
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
45
|
+
|:- |:- |:- |:- |:- |
|
|
46
|
+
| bgColor | 背景颜色 | String | transparent(背景透明) | - |
|
|
47
|
+
| height | 间隔槽高度,单位`px(rpx)` | String | Number | 20 | - |
|
|
48
|
+
| marginTop | 与前一个元素的距离,单位`px(rpx)` | String | Number | 0 | - |
|
|
49
|
+
| marginBottom | 与后一个元素的距离,单位`px(rpx)` | String | Number | 0 | - |
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
## Grid 宫格布局 <to-api/>
|
|
2
|
+
|
|
3
|
+
<demo-model url="/pages/componentsC/grid/grid"></demo-model>
|
|
4
|
+
|
|
5
|
+
::: tip ✈
|
|
6
|
+
|
|
7
|
+
**组件名:uv-grid > uv-grid-item**
|
|
8
|
+
|
|
9
|
+
[点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-grid)
|
|
10
|
+
|
|
11
|
+
:::
|
|
12
|
+
|
|
13
|
+
宫格组件一般用于同时展示多个同类项目的场景,可以给宫格的项目设置徽标组件([badge](/components/badge.html)),或者图标等,也可以扩展为左右滑动的轮播形式。
|
|
14
|
+
|
|
15
|
+
### 平台兼容性
|
|
16
|
+
|
|
17
|
+
|App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
|
|
18
|
+
|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
19
|
+
|√|√|√|√(仅支持微信小程序,[原因](https://www.uvui.cn/components/problem.html#%E4%B8%83%E3%80%81uv-row%E3%80%81uv-grid%E7%AD%89%E7%BB%84%E4%BB%B6%E5%9C%A8%E7%99%BE%E5%BA%A6%E5%B0%8F%E7%A8%8B%E5%BA%8F%E3%80%81%E6%8A%96%E9%9F%B3%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AD%89%E5%B9%B3%E5%8F%B0%E6%98%BE%E7%A4%BA%E5%BC%82%E5%B8%B8))|√|√|
|
|
20
|
+
|
|
21
|
+
### 基本使用
|
|
22
|
+
|
|
23
|
+
- 该组件外层为`uv-grid`组件包裹,通过`col`设置内部宫格的列数
|
|
24
|
+
- 内部通过`uv-grid-item`组件的`slot`设置宫格的内容
|
|
25
|
+
- 如果不需要宫格的边框,可以设置`border`为`false`
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<template>
|
|
29
|
+
<view>
|
|
30
|
+
<uv-grid :border="false">
|
|
31
|
+
<uv-grid-item v-for="(item,index) in baseList" :key="index">
|
|
32
|
+
<uv-icon :customStyle="{paddingTop:20+'rpx'}" :name="item.name" :size="22"></uv-icon>
|
|
33
|
+
<text class="grid-text">{{item.title}}</text>
|
|
34
|
+
</uv-grid-item>
|
|
35
|
+
</uv-grid>
|
|
36
|
+
</view>
|
|
37
|
+
</template>
|
|
38
|
+
<script setup>
|
|
39
|
+
import { ref } from 'vue';
|
|
40
|
+
|
|
41
|
+
const baseList = ref([{
|
|
42
|
+
name: 'photo',
|
|
43
|
+
title: '李白'
|
|
44
|
+
}, {
|
|
45
|
+
name: 'lock',
|
|
46
|
+
title: '韩信'
|
|
47
|
+
}, {
|
|
48
|
+
name: 'star',
|
|
49
|
+
title: '刘备'
|
|
50
|
+
}]);
|
|
51
|
+
|
|
52
|
+
</script>
|
|
53
|
+
<style lang="scss">
|
|
54
|
+
.grid-text {
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
color: #909399;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 绑定点击事件&自定义列数
|
|
62
|
+
|
|
63
|
+
通过`col`属性设置列数,默认列数为3
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<template>
|
|
67
|
+
<view>
|
|
68
|
+
<uv-grid :col="4" @click="click">
|
|
69
|
+
<uv-grid-item v-for="(item,index) in baseList" :key="index">
|
|
70
|
+
<uv-icon :customStyle="{paddingTop:20+'rpx'}" :name="item.name" :size="22"></uv-icon>
|
|
71
|
+
<text class="grid-text">{{item.title}}</text>
|
|
72
|
+
</uv-grid-item>
|
|
73
|
+
</uv-grid>
|
|
74
|
+
</view>
|
|
75
|
+
</template>
|
|
76
|
+
<script setup>
|
|
77
|
+
import { ref } from 'vue';
|
|
78
|
+
|
|
79
|
+
const baseList = ref([{
|
|
80
|
+
name: 'photo',
|
|
81
|
+
title: '李白'
|
|
82
|
+
}, {
|
|
83
|
+
name: 'lock',
|
|
84
|
+
title: '韩信'
|
|
85
|
+
}, {
|
|
86
|
+
name: 'star',
|
|
87
|
+
title: '刘备'
|
|
88
|
+
}, {
|
|
89
|
+
name: 'star',
|
|
90
|
+
title: '元芳'
|
|
91
|
+
}]);
|
|
92
|
+
function click(name) {
|
|
93
|
+
uni.showToast({
|
|
94
|
+
icon: 'none',
|
|
95
|
+
title: `点击了第${name}个`
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
</script>
|
|
100
|
+
<style lang="scss">
|
|
101
|
+
.grid-text {
|
|
102
|
+
font-size: 14px;
|
|
103
|
+
color: #909399;
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 实现宫格的左右滑动
|
|
109
|
+
|
|
110
|
+
结合`uni`的`swiper`组件可以实现宫格的左右滑动,因为`swiper`特性的关系,请指定`swiper`的高度 ,否则`swiper`的高度不会被内容撑开,可以自定义`swiper`的指示器,达到更高的灵活度
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<template>
|
|
114
|
+
<view>
|
|
115
|
+
<swiper :indicator-dots="true" class="swiper">
|
|
116
|
+
<swiper-item>
|
|
117
|
+
<uv-grid :border="true" align="center">
|
|
118
|
+
<uv-grid-item
|
|
119
|
+
:customStyle="{width:220+'rpx',height:220+'rpx'}"
|
|
120
|
+
v-for="(item, index) in swiperList"
|
|
121
|
+
:index="index"
|
|
122
|
+
:key="index">
|
|
123
|
+
<uv-icon :customStyle="{paddingTop:20+'rpx'}" :name="item" :size="22"></uv-icon>
|
|
124
|
+
<text class="grid-text">{{ '宫格' + (index + 1) }}</text>
|
|
125
|
+
</uv-grid-item>
|
|
126
|
+
</uv-grid>
|
|
127
|
+
</swiper-item>
|
|
128
|
+
<swiper-item>
|
|
129
|
+
<uv-grid :border="true" align="center">
|
|
130
|
+
<uv-grid-item
|
|
131
|
+
:customStyle="{width:220+'rpx',height:220+'rpx'}"
|
|
132
|
+
v-for="(item, index) in swiperList"
|
|
133
|
+
:index="index + 9"
|
|
134
|
+
:key="index">
|
|
135
|
+
<uv-icon :customStyle="{paddingTop:20+'rpx'}" :name="item" :size="22"></uv-icon>
|
|
136
|
+
<text class="grid-text">{{ '宫格' + (index + 1) }}</text>
|
|
137
|
+
</uv-grid-item>
|
|
138
|
+
</uv-grid>
|
|
139
|
+
</swiper-item>
|
|
140
|
+
<swiper-item>
|
|
141
|
+
<uv-grid :border="true" align="center">
|
|
142
|
+
<uv-grid-item
|
|
143
|
+
:customStyle="{width:220+'rpx',height:220+'rpx'}"
|
|
144
|
+
v-for="(item, index) in swiperList"
|
|
145
|
+
:index="index + 18"
|
|
146
|
+
:key="index">
|
|
147
|
+
<uv-icon :customStyle="{paddingTop:20+'rpx'}" :name="item" :size="22"></uv-icon>
|
|
148
|
+
<text class="grid-text">{{ "宫格" + (index + 1) }}</text>
|
|
149
|
+
</uv-grid-item>
|
|
150
|
+
</uv-grid>
|
|
151
|
+
</swiper-item>
|
|
152
|
+
</swiper>
|
|
153
|
+
</view>
|
|
154
|
+
</template>
|
|
155
|
+
<script setup>
|
|
156
|
+
import { ref } from 'vue';
|
|
157
|
+
|
|
158
|
+
const swiperList = ref(['integral', 'kefuv-ermai', 'coupon', 'gift', 'scan', 'pause-circle', 'volume-off', 'email', 'list']);
|
|
159
|
+
|
|
160
|
+
</script>
|
|
161
|
+
<style lang="scss">
|
|
162
|
+
.swiper {
|
|
163
|
+
height: 720rpx;
|
|
164
|
+
}
|
|
165
|
+
.grid-text {
|
|
166
|
+
font-size: 14px;
|
|
167
|
+
color: #909399;
|
|
168
|
+
padding: 10rpx 0 20rpx 0rpx;
|
|
169
|
+
/* #ifndef APP-PLUS */
|
|
170
|
+
box-sizing: border-box;
|
|
171
|
+
/* #endif */
|
|
172
|
+
}
|
|
173
|
+
</style>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 完整示例
|
|
177
|
+
|
|
178
|
+
::: tip 完整示例下载地址
|
|
179
|
+
|
|
180
|
+
[https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
181
|
+
|
|
182
|
+
:::
|
|
183
|
+
|
|
184
|
+
### API
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### Grid Props
|
|
188
|
+
|
|
189
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
190
|
+
|:- |:- |:- |:- |:- |
|
|
191
|
+
| col | 宫格的列数 | String | Number | 3 | - |
|
|
192
|
+
| border| 是否显示宫格的边框 | Boolean | true | true | false |
|
|
193
|
+
| align | 宫格的对齐方式,用于控制只有一两个宫格时的对齐场景 | String | left | left | center | right|
|
|
194
|
+
| customStyle | 自定义外部样式 | Object | - | - |
|
|
195
|
+
|
|
196
|
+
### GridItem Props
|
|
197
|
+
|
|
198
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
199
|
+
|:- |:- |:- |:- |:- |
|
|
200
|
+
| name | 宫格的`name` | String | Number | - | - |
|
|
201
|
+
| bgColor | 宫格的背景颜色 | String | transparent(背景透明) | - |
|
|
202
|
+
|
|
203
|
+
### Grid Events
|
|
204
|
+
|
|
205
|
+
注意:请在`<uv-grid></uv-grid>`上监听此事件
|
|
206
|
+
|
|
207
|
+
|事件名 |说明 |回调参数 |
|
|
208
|
+
|:- |:- |:- |
|
|
209
|
+
|@click |点击宫格触发 |name |
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### GridItem Events
|
|
213
|
+
|
|
214
|
+
注意:请在`<uv-grid-item></uv-grid-item>`上监听此事件
|
|
215
|
+
|
|
216
|
+
|事件名 |说明 |回调参数 |
|
|
217
|
+
|:- |:- |:- |
|
|
218
|
+
|@click |点击宫格触发 |name |
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<style scoped>
|
|
222
|
+
h3[id=grid-props] + table thead tr th:nth-child(2){
|
|
223
|
+
width: 40%;
|
|
224
|
+
}
|
|
225
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
|
|
2
|
+
## Icon 图标 <to-api/>
|
|
3
|
+
|
|
4
|
+
<demo-model url="/pages/componentsA/icon/icon"></demo-model>
|
|
5
|
+
|
|
6
|
+
::: tip ✈
|
|
7
|
+
|
|
8
|
+
**组件名:uv-icon**
|
|
9
|
+
|
|
10
|
+
[点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-icon)
|
|
11
|
+
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
基于字体的图标集,包含了大多数常见场景的图标,使用简单,开箱即用,无需自己再写每个图标的样式,直接简单配置即可。支持自定义图标。
|
|
15
|
+
|
|
16
|
+
### 平台兼容性
|
|
17
|
+
|
|
18
|
+
|App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
|
|
19
|
+
|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
20
|
+
|√|√|√|√|√|√|
|
|
21
|
+
|
|
22
|
+
### 基本使用
|
|
23
|
+
|
|
24
|
+
<br>
|
|
25
|
+
|
|
26
|
+
通过`<uv-icon>`形式来调用,设置`name`参数为图标名即可。其中`color`默认为`#606266`,`size`默认为`16px`
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<uv-icon name="photo"></uv-icon>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 修改图标的样式
|
|
33
|
+
|
|
34
|
+
- 通过`color`参数修改图标的颜色
|
|
35
|
+
- 通过`size`参数修改图标的大小,单位为px
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<uv-icon name="photo" color="#2979ff" size="28"></uv-icon>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 图片图标
|
|
42
|
+
|
|
43
|
+
这里说的图片图标,指的是小图标,起作用定位为"icon"图标作用,而非大尺寸的图片展示场景,理论上,这个小图标应该为`png`格式的正方形图标。
|
|
44
|
+
|
|
45
|
+
使用方法:给组件的`name`参数传入一个图片链接即可显示字体图标,链接规则是由`/`斜杠或`base64`图片地址,同时`size`参数
|
|
46
|
+
也被设置为这个图片图标的宽度,由于是图片,如颜色`color`等参数都会失效。
|
|
47
|
+
|
|
48
|
+
```vue
|
|
49
|
+
<!-- 在线地址 -->
|
|
50
|
+
<uv-icon size="40" name="https://via.placeholder.com/50x50.png/3c9cff/fff"></uv-icon>
|
|
51
|
+
<!-- base64地址图标,仅作演示 -->
|
|
52
|
+
<uv-icon size="40" name="data:image/png;base64,..."></uv-icon>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 自定义图标
|
|
56
|
+
|
|
57
|
+
详见:[扩展自定义图标库](/guide/customIcon.html)
|
|
58
|
+
|
|
59
|
+
### 完整示例
|
|
60
|
+
|
|
61
|
+
::: tip 完整示例下载地址
|
|
62
|
+
|
|
63
|
+
[https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
64
|
+
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
### API
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Icon Props
|
|
72
|
+
|
|
73
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
74
|
+
|:- |:- |:- |:- |:- |
|
|
75
|
+
| name | 图标名称,若带有`/`或遵循`base64`图片格式,会被认为是图片图标 | String | - | - |
|
|
76
|
+
| color | 图标颜色,接受主题色eg: `color="primary"` | String | #606266 | - |
|
|
77
|
+
| size | 图标字体大小,单位`px(rpx)` | String | Number | 16px | - |
|
|
78
|
+
| bold | 是否显示粗体 | Boolean | false | true | false |
|
|
79
|
+
| index | 一个用于区分多个图标的值,点击图标时通过`click`事件传出 | String | Number | - | - |
|
|
80
|
+
| hoverClass | 图标按下去的样式类,用法同uni的`view`组件的`hover-class`参数,详见:[hover-class](https://uniapp.dcloud.io/component/view) | String | - | - |
|
|
81
|
+
| customPrefix | 自定义字体图标库时,需要写上此值,详见:[扩展自定义图标库](/guide/customIcon.html),注意:nvue暂时不支持 | String |uvicon | - |
|
|
82
|
+
| label | 图标右侧 / 下方的label文字 | String | Number | - | - |
|
|
83
|
+
| labelPos | `label`相对于图标的位置 | String | right | right | bottom | top | left |
|
|
84
|
+
| labelSize | `label`字体大小,单位px | String | Number | 15px | - |
|
|
85
|
+
| labelColor | `label`字体颜色 | String | #606266 | - |
|
|
86
|
+
| space | `label`与图标的距离,单位`px(rpx)` | String | Number | 3px | - |
|
|
87
|
+
| imgMode | 图片裁剪、缩放的模式,image组件原生属性,详见:[image](https://uniapp.dcloud.io/component/image?id=image) | String | - | - |
|
|
88
|
+
| width | `name`为图片图标时图片的宽度,单位`px(rpx)` | String | Number | - | - |
|
|
89
|
+
| height | `name`为图片图标时图片的高度,单位`px(rpx)` | String | Number | - | - |
|
|
90
|
+
| top | 图标到顶部的距离,如果某些场景,如果图标没有垂直居中,可以调整此参数,单位`px(rpx)` | String | Number | 0 | - |
|
|
91
|
+
| stop | 是否阻止事件传播 | Boolean | false | true | false |
|
|
92
|
+
|
|
93
|
+
### Icon Events
|
|
94
|
+
|
|
95
|
+
|事件名 |说明 |回调参数 |版本 |
|
|
96
|
+
|:- |:- |:- |:- |
|
|
97
|
+
|@click |点击图标时触发 |index: 通过`props`传递的`index`值 |- |
|
|
98
|
+
|
|
99
|
+
### 图标集
|
|
100
|
+
|
|
101
|
+
图标名称以包内组件和示例项目实际可用的图标集为准。需要扩展自定义图标时,请查看 [自定义图标](../guide/customIcon.md)。
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
## Image 图片 <to-api/>
|
|
2
|
+
|
|
3
|
+
<demo-model url="/pages/componentsA/image/image"></demo-model>
|
|
4
|
+
|
|
5
|
+
::: tip ✈
|
|
6
|
+
|
|
7
|
+
**组件名:uv-image**
|
|
8
|
+
|
|
9
|
+
[点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-image)
|
|
10
|
+
|
|
11
|
+
:::
|
|
12
|
+
|
|
13
|
+
此组件为uni-app的`image`组件的加强版,在继承了原有功能外,还支持淡入动画、加载中、加载失败提示、圆角值和形状等。
|
|
14
|
+
|
|
15
|
+
我们在图片中加入了`observer`懒加载的思想,由于官方提供的`lazyLoad`懒加载有些限制,可能在实际项目中并不能满足需求,`observer`可以真正意义上实现懒加载,具体使用会在下面有介绍。
|
|
16
|
+
|
|
17
|
+
**我们推荐您在任何使用图片场景的地方,都优先考虑使用这个小巧,uv-image精致而实用的组件。**
|
|
18
|
+
|
|
19
|
+
### 平台兼容性
|
|
20
|
+
|
|
21
|
+
|App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
|
|
22
|
+
|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
23
|
+
|√|√|√|√|√|√|
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### 基本使用
|
|
27
|
+
|
|
28
|
+
配置图片的`width`宽和`height`高,以及`src`路径即可使用。
|
|
29
|
+
|
|
30
|
+
```vue
|
|
31
|
+
<template>
|
|
32
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" width="80px" height="80px"></uv-image>
|
|
33
|
+
</template>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 图片裁剪、缩放的模式
|
|
37
|
+
|
|
38
|
+
通过`mode`参数配置填充模式,此模式用法与uni-app的`image`组件的`mode`参数完全一致,详见:[Image](https://uniapp.dcloud.io/component/image)
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" mode="widthFix"></uv-image>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 图片形状
|
|
45
|
+
|
|
46
|
+
- 通过`shape`参数设置图片的形状,`circle`为圆形,`square`为方形
|
|
47
|
+
- 如果为方形时,还可以通过`radius`属性设置圆角值
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" shape="circle"></uv-image>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### 懒加载
|
|
55
|
+
|
|
56
|
+
注意:此功能只对微信小程序、App、百度小程序、字节跳动小程序有效,且只针对page与scroll-view下的image有效,默认开启。
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" :lazy-load="true"></uv-image>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### observer懒加载
|
|
63
|
+
|
|
64
|
+
- 通过`observeLazyLoad`为`true`即可开启该功能,效果:在该图片滑动到可视范围内的时候才会去请求加载图片。
|
|
65
|
+
- 注意:此功能在`nvue`页面不生效,因为nvue并不支持`uni.createIntersectionObserver()`,默认关闭。
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" :observeLazyLoad="true"></uv-image>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 加载中提示
|
|
72
|
+
|
|
73
|
+
图片加载过程中,为加载中状态(默认显示一个小图标),可以通过`loading`自定义插槽,结合uv-ui的`uv-loading`组件,实现加载的动画效果。
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg">
|
|
77
|
+
<template v-slot:loading>
|
|
78
|
+
<uv-loading-icon color="red"></uv-loading-icon>
|
|
79
|
+
</template>
|
|
80
|
+
</uv-image>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### 加载错误提示
|
|
85
|
+
|
|
86
|
+
图片加载失败时,默认显示一个错误提示图标,可以通过`error`自定义插槽,实现个性化的提示方式。
|
|
87
|
+
|
|
88
|
+
```vue
|
|
89
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg">
|
|
90
|
+
<template v-slot:error>
|
|
91
|
+
<view style="font-size: 24rpx;">加载失败</view>
|
|
92
|
+
</template>
|
|
93
|
+
</uv-image>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### 淡入动画
|
|
98
|
+
|
|
99
|
+
组件自带了加载完成时的淡入动画效果:
|
|
100
|
+
|
|
101
|
+
- 通过`fade`参数配置是否开启动画效果
|
|
102
|
+
- 通过`duration`参数配置动画的过渡时间,单位ms
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg" :fade="true" duration="450"></uv-image>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### 事件冒泡
|
|
110
|
+
|
|
111
|
+
默认情况下,组件是允许内部向外事件冒泡的,因为很多情况下,我们都希望点击图片,同时图片所在的父元素的点击事件也能触发。
|
|
112
|
+
如果您想避免事件冒泡,那么您可以在组件外面嵌套一个`view`,同时给它加上`@tap.stop`即可。
|
|
113
|
+
|
|
114
|
+
```vue
|
|
115
|
+
<!-- 点击图片将不会触发clickHandler -->
|
|
116
|
+
<view @tap="clickHandler">
|
|
117
|
+
<view @tap.stop>
|
|
118
|
+
<uv-image src="https://cdn.uviewui.com/uview/album/1.jpg"></uv-image>
|
|
119
|
+
</view>
|
|
120
|
+
</view>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 完整示例
|
|
124
|
+
|
|
125
|
+
::: tip 完整示例下载地址
|
|
126
|
+
|
|
127
|
+
[https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
|
128
|
+
|
|
129
|
+
:::
|
|
130
|
+
|
|
131
|
+
### API
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### Image Props
|
|
135
|
+
|
|
136
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
|
137
|
+
|:- |:- |:- |:- |:- |
|
|
138
|
+
| src | 图片地址,**强烈建议**使用绝对或者网络路径 | String | - | - |
|
|
139
|
+
| mode | 裁剪模式,见上方说明 | String | aspectFill | - |
|
|
140
|
+
| width | 宽度,单位任意,如果为数值,默认单位`px(rpx)` | String | Number | 300 | - |
|
|
141
|
+
| height | 高度,单位任意,如果为数值,默认单位`px(rpx)` | String | Number | 225 | - |
|
|
142
|
+
| shape | 图片形状,`circle` - 圆形,`square` - 方形 | String | square | square |
|
|
143
|
+
| radius | 圆角,默认单位px | String | Number | 0 | - |
|
|
144
|
+
| lazyLoad | 是否懒加载,仅微信小程序、App、百度小程序、字节跳动小程序有效 | Boolean | true | false | - |
|
|
145
|
+
| observeLazyLoad | 是否observer懒加载,在该图片滑动到可视范围内的时候才会去请求加载图片。nvue页面不生效。 | Boolean | false| true | false|
|
|
146
|
+
| showMenuByLongpress | 是否开启长按图片显示识别小程序码菜单,仅微信小程序有效 | Boolean | true | - |
|
|
147
|
+
| loadingIcon | 加载中的图标,或者小图片 | String | photo | - |
|
|
148
|
+
| errorIcon | 加载失败的图标,或者小图片 | String | error-circle | - |
|
|
149
|
+
| showLoading | 是否显示加载中的图标或者自定义的`slot` | Boolean | true | true | false |
|
|
150
|
+
| showError | 是否显示加载错误的图标或者自定义的`slot` | Boolean | true | true | false |
|
|
151
|
+
| fade | 是否需要淡入效果 | Boolean | true | true | false |
|
|
152
|
+
| webp | 只支持网络资源,只对微信小程序有效 | Boolean | false | true | false |
|
|
153
|
+
| duration | 搭配`fade`参数的过渡时间,单位`ms` | String | Number | 500 | - |
|
|
154
|
+
| bgColor | 背景颜色,用于深色页面加载图片时,为了和背景色融合 | String | #f3f4f6 | - |
|
|
155
|
+
| cellChild | 是否属于cell节点下。`nvue`模式下的该组件在cell或uv-list等组件下使用,该值最好是设置成true,避免回收后不显示的BUG。 | Boolean | false | true | false|
|
|
156
|
+
| customStyle | 自定义样式 | Object | - | - |
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
### Image Slots
|
|
160
|
+
|
|
161
|
+
|名称 |说明 |
|
|
162
|
+
|:- |:- |
|
|
163
|
+
| loading | 自定义加载中的提示内容 |
|
|
164
|
+
| error | 自定义失败的提示内容 |
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Image Events
|
|
168
|
+
|
|
169
|
+
|事件名 |说明 |回调参数 |
|
|
170
|
+
|:- |:- |:- |
|
|
171
|
+
| @click | 点击图片时触发 | - |
|
|
172
|
+
| @error | 图片加载失败时触发 | err: 错误信息 |
|
|
173
|
+
| @load | 图片加载成功时触发 | - |
|
|
174
|
+
|
|
175
|
+
<style scoped>
|
|
176
|
+
h3[id=image-slots] + table thead tr th:nth-child(2){
|
|
177
|
+
width: 70%;
|
|
178
|
+
}
|
|
179
|
+
h3[id=image-events] + table thead tr th:nth-child(2){
|
|
180
|
+
width: 40%;
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# 组件
|
|
2
|
+
|
|
3
|
+
`@gmcb/uv-ui` 提供一组以 `uv-` 开头的 uni-app 多端组件。推荐通过 easycom 使用组件,不需要在页面内逐个 `import`。
|
|
4
|
+
|
|
5
|
+
## easycom
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"easycom": {
|
|
10
|
+
"autoscan": true,
|
|
11
|
+
"custom": {
|
|
12
|
+
"^uv-(.*)": "@gmcb/uv-ui/components/uv-$1/uv-$1.vue"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 基础组件
|
|
19
|
+
|
|
20
|
+
| 组件 | 说明 |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| [button](./button.md) | 按钮。 |
|
|
23
|
+
| [icon](./icon.md) | 图标。 |
|
|
24
|
+
| [image](./image.md) | 图片。 |
|
|
25
|
+
| [text](./text.md) | 文本。 |
|
|
26
|
+
| [link](./link.md) | 链接。 |
|
|
27
|
+
| [tag](./tag.md) | 标签。 |
|
|
28
|
+
| [badge](./badge.md) | 徽标。 |
|
|
29
|
+
| [avatar](./avatar.md) | 头像。 |
|
|
30
|
+
| [line](./line.md) | 分割线。 |
|
|
31
|
+
| [gap](./gap.md) | 间隔。 |
|
|
32
|
+
|
|
33
|
+
## 布局与导航
|
|
34
|
+
|
|
35
|
+
| 组件 | 说明 |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| [layout](./layout.md) | 栅格布局。 |
|
|
38
|
+
| [grid](./grid.md) | 宫格。 |
|
|
39
|
+
| [cell](./cell.md) | 单元格。 |
|
|
40
|
+
| [navbar](./navbar.md) | 自定义导航栏。 |
|
|
41
|
+
| [tabbar](./tabbar.md) | 底部导航。 |
|
|
42
|
+
| [tabs](./tabs.md) | 标签页。 |
|
|
43
|
+
| [sticky](./sticky.md) | 吸顶。 |
|
|
44
|
+
| [indexList](./indexList.md) | 索引列表。 |
|
|
45
|
+
| [list](./list.md) | 列表。 |
|
|
46
|
+
| [scrollList](./scrollList.md) | 横向滚动列表。 |
|
|
47
|
+
|
|
48
|
+
## 表单
|
|
49
|
+
|
|
50
|
+
| 组件 | 说明 |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| [form](./form.md) | 表单。 |
|
|
53
|
+
| [input](./input.md) | 输入框。 |
|
|
54
|
+
| [textarea](./textarea.md) | 多行输入。 |
|
|
55
|
+
| [checkbox](./checkbox.md) | 复选框。 |
|
|
56
|
+
| [radio](./radio.md) | 单选框。 |
|
|
57
|
+
| [switch](./switch.md) | 开关。 |
|
|
58
|
+
| [slider](./slider.md) | 滑块。 |
|
|
59
|
+
| [numberBox](./numberBox.md) | 步进器。 |
|
|
60
|
+
| [rate](./rate.md) | 评分。 |
|
|
61
|
+
| [upload](./upload.md) | 上传。 |
|
|
62
|
+
| [codeInput](./codeInput.md) | 验证码输入。 |
|
|
63
|
+
| [keyboard](./keyboard.md) | 键盘。 |
|
|
64
|
+
|
|
65
|
+
## 反馈与弹层
|
|
66
|
+
|
|
67
|
+
| 组件 | 说明 |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| [popup](./popup.md) | 弹出层。 |
|
|
70
|
+
| [modal](./modal.md) | 模态框。 |
|
|
71
|
+
| [toast](./toast.md) | 轻提示。 |
|
|
72
|
+
| [notify](./notify.md) | 消息通知。 |
|
|
73
|
+
| [actionSheet](./actionSheet.md) | 操作菜单。 |
|
|
74
|
+
| [overlay](./overlay.md) | 遮罩。 |
|
|
75
|
+
| [tooltip](./tooltip.md) | 文字提示。 |
|
|
76
|
+
| [loadingIcon](./loadingIcon.md) | 加载图标。 |
|
|
77
|
+
| [loadingPage](./loadingPage.md) | 加载页。 |
|
|
78
|
+
| [loadMore](./loadMore.md) | 加载更多。 |
|
|
79
|
+
| [noNetwork](./noNetwork.md) | 无网络提示。 |
|
|
80
|
+
|
|
81
|
+
## 数据与展示
|
|
82
|
+
|
|
83
|
+
| 组件 | 说明 |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| [calendar](./calendar.md) | 日历。 |
|
|
86
|
+
| [calendars](./calendars.md) | 多日历。 |
|
|
87
|
+
| [datetimePicker](./datetimePicker.md) | 日期时间选择。 |
|
|
88
|
+
| [picker](./picker.md) | 选择器。 |
|
|
89
|
+
| [swiper](./swiper.md) | 轮播。 |
|
|
90
|
+
| [album](./album.md) | 相册。 |
|
|
91
|
+
| [waterfall](./waterfall.md) | 瀑布流。 |
|
|
92
|
+
| [qrcode](./qrcode.md) | 二维码。 |
|
|
93
|
+
| [parse](./parse.md) | 富文本解析。 |
|
|
94
|
+
| [skeleton](./skeleton.md) | 骨架屏。 |
|
|
95
|
+
| [empty](./empty.md) | 空状态。 |
|
|
96
|
+
| [steps](./steps.md) | 步骤条。 |
|
|
97
|
+
| [countDown](./countDown.md) | 倒计时。 |
|
|
98
|
+
| [countTo](./countTo.md) | 数字滚动。 |
|
|
99
|
+
| [lineProgress](./lineProgress.md) | 线形进度条。 |
|
|
100
|
+
| [circleProgress](./circleProgress.md) | 圆形进度条。 |
|
|
101
|
+
|
|
102
|
+
## 其他
|
|
103
|
+
|
|
104
|
+
| 文档 | 说明 |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| [安装](./install.md) | 安装说明。 |
|
|
107
|
+
| [快速上手](./quickstart.md) | 快速使用。 |
|
|
108
|
+
| [扩展配置](./setting.md) | `$uv`、主题和默认 props 配置。 |
|
|
109
|
+
| [常见问题](./problem.md) | 组件常见问题。 |
|
|
110
|
+
| [nvue](./nvue.md) | nvue 兼容说明。 |
|