@gmcb/uv-ui 0.2.26 → 0.3.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.
Files changed (137) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +21 -21
  3. package/README.md +95 -141
  4. package/components/uv-overlay/props.js +29 -24
  5. package/components/uv-overlay/uv-overlay.vue +87 -85
  6. package/docs/api/configs/color.md +52 -0
  7. package/docs/api/index.md +77 -0
  8. package/docs/api/mixins/mpShare.md +95 -0
  9. package/docs/api/request/apiManage.md +88 -0
  10. package/docs/api/request/http.md +451 -0
  11. package/docs/api/utils/colorSwitch.md +78 -0
  12. package/docs/api/utils/debounce.md +104 -0
  13. package/docs/api/utils/fastUse.md +246 -0
  14. package/docs/api/utils/getRect.md +238 -0
  15. package/docs/api/utils/guid.md +41 -0
  16. package/docs/api/utils/index.md +55 -0
  17. package/docs/api/utils/intro.md +25 -0
  18. package/docs/api/utils/object.md +171 -0
  19. package/docs/api/utils/queryParams.md +68 -0
  20. package/docs/api/utils/random.md +23 -0
  21. package/docs/api/utils/randomArray.md +28 -0
  22. package/docs/api/utils/route.md +121 -0
  23. package/docs/api/utils/test.md +237 -0
  24. package/docs/api/utils/time.md +81 -0
  25. package/docs/api/utils/trim.md +24 -0
  26. package/docs/components/actionSheet.md +236 -0
  27. package/docs/components/addQQGroup.md +5 -0
  28. package/docs/components/album.md +91 -0
  29. package/docs/components/alert.md +83 -0
  30. package/docs/components/avatar.md +152 -0
  31. package/docs/components/backTop.md +181 -0
  32. package/docs/components/badge.md +117 -0
  33. package/docs/components/button.md +196 -0
  34. package/docs/components/calendar.md +398 -0
  35. package/docs/components/calendars.md +294 -0
  36. package/docs/components/cell.md +185 -0
  37. package/docs/components/checkbox.md +281 -0
  38. package/docs/components/circleProgress.md +5 -0
  39. package/docs/components/code.md +162 -0
  40. package/docs/components/codeInput.md +175 -0
  41. package/docs/components/collapse.md +250 -0
  42. package/docs/components/color.md +324 -0
  43. package/docs/components/common.md +126 -0
  44. package/docs/components/countDown.md +166 -0
  45. package/docs/components/countTo.md +140 -0
  46. package/docs/components/datetimePicker.md +283 -0
  47. package/docs/components/diff1.x.md +190 -0
  48. package/docs/components/divider.md +88 -0
  49. package/docs/components/downloadSetting.md +54 -0
  50. package/docs/components/dropDown.md +375 -0
  51. package/docs/components/empty.md +99 -0
  52. package/docs/components/feature.md +261 -0
  53. package/docs/components/form.md +736 -0
  54. package/docs/components/gap.md +49 -0
  55. package/docs/components/grid.md +225 -0
  56. package/docs/components/icon.md +101 -0
  57. package/docs/components/image.md +182 -0
  58. package/docs/components/index.md +110 -0
  59. package/docs/components/indexList.md +133 -0
  60. package/docs/components/input.md +250 -0
  61. package/docs/components/install.md +59 -0
  62. package/docs/components/intro.md +32 -0
  63. package/docs/components/keyboard.md +226 -0
  64. package/docs/components/layout.md +310 -0
  65. package/docs/components/line.md +85 -0
  66. package/docs/components/lineProgress.md +141 -0
  67. package/docs/components/link.md +89 -0
  68. package/docs/components/list.md +223 -0
  69. package/docs/components/loadMore.md +140 -0
  70. package/docs/components/loadingIcon.md +144 -0
  71. package/docs/components/loadingPage.md +92 -0
  72. package/docs/components/modal.md +230 -0
  73. package/docs/components/more.md +13 -0
  74. package/docs/components/navbar.md +192 -0
  75. package/docs/components/noNetwork.md +116 -0
  76. package/docs/components/noticeBar.md +131 -0
  77. package/docs/components/notify.md +204 -0
  78. package/docs/components/npmSetting.md +64 -0
  79. package/docs/components/numberBox.md +257 -0
  80. package/docs/components/nvue.md +170 -0
  81. package/docs/components/overlay.md +117 -0
  82. package/docs/components/parse.md +204 -0
  83. package/docs/components/pickColor.md +112 -0
  84. package/docs/components/picker.md +357 -0
  85. package/docs/components/popup.md +221 -0
  86. package/docs/components/problem.md +300 -0
  87. package/docs/components/qrcode.md +169 -0
  88. package/docs/components/quickstart.md +33 -0
  89. package/docs/components/radio.md +256 -0
  90. package/docs/components/rate.md +128 -0
  91. package/docs/components/read.md +163 -0
  92. package/docs/components/readMore.md +227 -0
  93. package/docs/components/resource.md +17 -0
  94. package/docs/components/scrollList.md +218 -0
  95. package/docs/components/search.md +160 -0
  96. package/docs/components/setting.md +111 -0
  97. package/docs/components/settingDesc.md +66 -0
  98. package/docs/components/skeleton.md +105 -0
  99. package/docs/components/skeletons.md +323 -0
  100. package/docs/components/slider.md +157 -0
  101. package/docs/components/steps.md +189 -0
  102. package/docs/components/sticky.md +76 -0
  103. package/docs/components/subsection.md +183 -0
  104. package/docs/components/swipeAction.md +279 -0
  105. package/docs/components/swiper.md +352 -0
  106. package/docs/components/switch.md +216 -0
  107. package/docs/components/tabbar.md +263 -0
  108. package/docs/components/table.md +5 -0
  109. package/docs/components/tabs.md +364 -0
  110. package/docs/components/tag.md +227 -0
  111. package/docs/components/testPic.md +20 -0
  112. package/docs/components/text.md +157 -0
  113. package/docs/components/textarea.md +121 -0
  114. package/docs/components/toast.md +124 -0
  115. package/docs/components/tooltip.md +98 -0
  116. package/docs/components/transition.md +404 -0
  117. package/docs/components/upload.md +253 -0
  118. package/docs/components/vtabs.md +332 -0
  119. package/docs/components/vueUse.md +45 -0
  120. package/docs/components/vuexDetail.md +103 -0
  121. package/docs/components/waterfall.md +651 -0
  122. package/docs/faq/index.md +53 -0
  123. package/docs/guide/codeHint.md +44 -0
  124. package/docs/guide/customIcon.md +168 -0
  125. package/docs/guide/demo.md +92 -0
  126. package/docs/guide/design.md +56 -0
  127. package/docs/guide/globalVariable.md +239 -0
  128. package/docs/guide/i18n.md +194 -0
  129. package/docs/guide/index.md +28 -0
  130. package/docs/guide/note.md +74 -0
  131. package/docs/guide/safeAreaInset.md +64 -0
  132. package/docs/guide/theme.md +67 -0
  133. package/docs/index.md +88 -0
  134. package/libs/config/config.js +0 -10
  135. package/libs/css/color.scss +15 -14
  136. package/package.json +7 -2
  137. package/theme.scss +2 -1
@@ -0,0 +1,81 @@
1
+ ## Time 时间格式化
2
+
3
+ ### 按需引入
4
+
5
+ 如果未做全局[扩展配置](https://www.uvui.cn/components/setting.html),可以按需引入:
6
+
7
+ ```js
8
+ // 引入
9
+ import { timeFormat } from '@gmcb/uv-ui/libs/function/index.js';
10
+ // 调用
11
+ timeFormat(...);
12
+ ```
13
+
14
+ ### timeFormat(time,format) | date(time,format) 格式化时间
15
+
16
+ 该函数必须传入第一个参数,第二个参数是可选的,函数返回一个格式化好的时间。
17
+
18
+ - `time` <String\> 任何合法的 `时间格式`、`秒` 或 `毫秒` 的时间戳
19
+ - `format` <String\> 时间格式,可选。默认为`yyyy-mm-dd`,年为"yyyy",月为"mm",日为"dd",时为"hh",分为"MM",秒为"ss",格式可以自由搭配,如:
20
+ `yyyy:mm:dd`,`yyyy-mm-dd`,`yyyy年mm月dd日`,`yyyy年mm月dd日 hh时MM分ss秒`,`yyyy/mm/dd/`,`MM:ss`等组合
21
+
22
+ ```vue
23
+ <template>
24
+ <view>
25
+ <view>时间1为:{{time}}</view>
26
+ <view>时间2为:{{time2}}</view>
27
+ <view>时间3为:{{time3}}</view>
28
+ <view>时间4为:{{time4}}</view>
29
+ </view>
30
+ </template>
31
+ <script setup>
32
+ import { computed } from "vue";
33
+ const time = computed(() => {
34
+ return uni.$uv.timeFormat(new Date().getTime());
35
+ });
36
+ const time2 = computed(() => {
37
+ return uni.$uv.timeFormat('2023-08-06', 'yyyy年mm月dd日 hh时MM分ss秒');
38
+ });
39
+ const time3 = computed(() => {
40
+ return uni.$uv.date(new Date().getTime(), 'yyyy/mm/dd');
41
+ });
42
+ const time4 = computed(() => {
43
+ return uni.$uv.date('2023-08-06', 'yyyy年mm月dd日');
44
+ });
45
+
46
+ </script>
47
+ ```
48
+
49
+ ### timeFrom(time, format = String | false) 多久以前
50
+
51
+ 该函数必须传入第一个参数,格式为任何合法的`时间格式`、`秒`或`毫秒`的时间戳,第二个参数是可选的,返回的值类似`刚刚`,`25分钟前`,`3小时前`,`7天前`的结果。
52
+
53
+ 如果第二个参数是时间的格式,当前和传入时间戳相差大于一个月时,返回格式化好的时间;如果第二个参数为`false`,则不会返回格式化好的时间,而是诸如"xxx年前"的结果。
54
+
55
+ - `timestamp` <String\> 时间戳
56
+ - `format` <String / false\> 时间格式,默认为`yyyy-mm-dd`,年为"yyyy",月为"mm",日为"dd",时为"hh",分为"MM",秒为"ss",格式可以自由搭配,如:
57
+ `yyyy:mm:dd`,`yyyy-mm-dd`,`yyyy年mm月dd日`,`yyyy年mm月dd日 hh时MM分ss秒`,`yyyy/mm/dd/`,`MM:ss`等组合。
58
+ 如果时间戳距离此时的时间,大于一个月,则返回一个格式化好的时间,如果此参数为`false`,返回均为"多久之前"的结果。
59
+
60
+ ```vue
61
+ <template>
62
+ <view>
63
+ <view>时间1为:{{time1}}</view>
64
+ <view>时间2为:{{time2}}</view>
65
+ <view>时间3为:{{time3}}</view>
66
+ </view>
67
+ </template>
68
+ <script setup>
69
+ import { computed } from "vue";
70
+ const time1 = computed(() => {
71
+ return uni.$uv.timeFrom(new Date().getTime());
72
+ });
73
+ const time2 = computed(() => {
74
+ return uni.$uv.timeFrom(new Date('2023-02-06').getTime(), false);
75
+ });
76
+ const time3 = computed(() => {
77
+ return uni.$uv.timeFrom(new Date('2023-02-06').getTime(), 'yyyy年mm月dd日');
78
+ });
79
+
80
+ </script>
81
+ ```
@@ -0,0 +1,24 @@
1
+ ## Trim 去除空格
2
+
3
+ ### 按需引入
4
+
5
+ 如果未做全局[扩展配置](https://www.uvui.cn/components/setting.html),可以按需引入:
6
+
7
+ ```js
8
+ // 引入,实例中未写完,自己根据需求写
9
+ import { trim } from '@gmcb/uv-ui/libs/function/test.js';
10
+ // 调用
11
+ trim('你好 ');
12
+ ```
13
+
14
+ ### trim(str, pos)
15
+
16
+ 该方法可以去除空格,分别可以去除所有空格,两端空格,左边空格,右边空格,默认为去除两端空格
17
+
18
+ - `str` <String\> 字符串
19
+ - `pos` <String\> 去除那些位置的空格,可选为:`both`-默认值,去除两端空格,`left`-去除左边空格,`right`-去除右边空格,`all`-去除包括中间和两端的所有空格
20
+
21
+ ```js
22
+ console.log(uni.$uv.trim('abc b ', 'all')); // 去除所有空格
23
+ console.log(uni.$uv.trim(' abc ')); // 去除两端空格
24
+ ```
@@ -0,0 +1,236 @@
1
+ ## ActionSheet 操作菜单 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsD/actionSheet/actionSheet"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-action-sheet**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-action-sheet)
10
+
11
+ :::
12
+
13
+ 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。
14
+ 本组件功能类似于uni的`uni.showActionSheet`API,配置更加灵活,所有平台都表现一致。
15
+
16
+ ### 平台兼容性
17
+
18
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
19
+ |:-:|:-:|:-:|:-:|:-:|:-:|
20
+ |√|√|√|√|√|√|
21
+
22
+ ### 基本使用
23
+
24
+ - 通过`title`(设置标题),`cancelText`(取消按钮的文字,不为空时显示按钮),`description`(选项上方的描述信息)。
25
+ - 通过`actions`设置需要显示的菜单,该值为一个数组,元素为对象,对象至少要提供`name`属性,另外可选的有`subname`(描述),`disabled`(是否禁用),`loading`(加载动画),
26
+ `color`(字体颜色),`fontSize`(字体大小)。
27
+ - 通过`ref`调用`open()`控制组件的打开。
28
+
29
+ ```vue
30
+ <template>
31
+ <view>
32
+ <uv-action-sheet
33
+ ref="actionSheet"
34
+ :actions="list"
35
+ title="标题"
36
+ @select="select"
37
+ @close="close">
38
+ </uv-action-sheet>
39
+ <button @click="open">打开ActionSheet</button>
40
+ </view>
41
+ </template>
42
+ <script setup>
43
+ import { ref } from 'vue';
44
+
45
+ const actionSheet = ref(null);
46
+ const list = ref([{
47
+ name: '选项一',
48
+ subname: "选项一描述",
49
+ color: '#ffaa7f',
50
+ fontSize: '20'
51
+ }, {
52
+ name: '选项二禁用',
53
+ disabled: true
54
+ }, {
55
+ name: '开启load加载',
56
+ //开启后文字不显示
57
+ loading: true
58
+ }]);
59
+ function open() {
60
+ actionSheet.value.open();
61
+ }
62
+ function select(e) {
63
+ console.log('选中该项:', e);
64
+ }
65
+ function close() {
66
+ console.log('关闭');
67
+ }
68
+
69
+ </script>
70
+ ```
71
+
72
+ ### 配置点击遮罩关闭和点击某个菜单项时关闭弹窗
73
+
74
+ - 通过`closeOnClickAction`参数来配置点击某个菜单项时是否关闭弹窗,设置为`false`不影响`select`事件返回,默认`true`。
75
+ - 通过`closeOnClickOverlay`参数配置点击遮罩是否允许关闭,默认`true`。
76
+
77
+ ```vue
78
+ <template>
79
+ <view>
80
+ <uv-action-sheet
81
+ ref="actionSheet"
82
+ :actions="list"
83
+ title="标题"
84
+ :closeOnClickOverlay="false"
85
+ :closeOnClickAction="false"
86
+ @select="select"
87
+ @close="close">
88
+ </uv-action-sheet>
89
+ <button @click="open">打开ActionSheet</button>
90
+ </view>
91
+ </template>
92
+ <script setup>
93
+ import { ref } from 'vue';
94
+
95
+ const actionSheet = ref(null);
96
+ const list = ref([{
97
+ name: '选项一'
98
+ }, {
99
+ name: '选项二'
100
+ }]);
101
+ function open() {
102
+ actionSheet.value.open();
103
+ }
104
+ function select(e) {
105
+ console.log('选中该项:', e);
106
+ }
107
+ function close() {
108
+ console.log('关闭');
109
+ }
110
+
111
+ </script>
112
+ ```
113
+
114
+ ### 选项开放能力
115
+
116
+ 所有开放能力请参考`uni`提供的`button`[开放能力](https://uniapp.dcloud.net.cn/component/button.html#open-type-%E6%9C%89%E6%95%88%E5%80%BC)。
117
+
118
+ ```vue
119
+ <template>
120
+ <view>
121
+ <uv-action-sheet
122
+ ref="actionSheet"
123
+ :actions="list"
124
+ title="开放能力"
125
+ @select="select"
126
+ @close="close">
127
+ </uv-action-sheet>
128
+ <button @click="open">打开ActionSheet</button>
129
+ </view>
130
+ </template>
131
+ <script setup>
132
+ import { ref } from 'vue';
133
+
134
+ const actionSheet = ref(null);
135
+ const list = ref([{
136
+ name: '开放能力-分享',
137
+ openType: 'share'
138
+ }, {
139
+ name: '开放能力-获取用户信息',
140
+ openType: 'getUserInfo'
141
+ }, {
142
+ name: '开放能力-客服会话',
143
+ openType: 'contact'
144
+ }, {
145
+ name: '开放能力-其他'
146
+ }]);
147
+ function open() {
148
+ actionSheet.value.open();
149
+ }
150
+ function select(e) {
151
+ console.log('选中该项:', e);
152
+ if (e.name == '开放能力-其他') {
153
+ uni.showModal({
154
+ content: '参考uni提供的button开放能力',
155
+ showCancel: false
156
+ });
157
+ }
158
+ }
159
+ function close() {
160
+ console.log('关闭');
161
+ }
162
+
163
+ </script>
164
+ ```
165
+
166
+ ::: tip 完整示例下载地址
167
+
168
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
169
+
170
+ :::
171
+
172
+ ### API
173
+ ---
174
+
175
+ ### ActionSheet Props
176
+
177
+ | 参数 |说明 |类型 |默认值 |可选值 |
178
+ | :- |:- |:- |:- |:- |
179
+ | title | 设置标题 | String | - | - |
180
+ | description | 选项上方的描述信息 | String | - | - |
181
+ | actions | 按钮的文字数组,见上方文档示例 | Array\<Object\> | [ ] | - |
182
+ | cancelText | 取消按钮的文字,不为空时显示按钮 | String | - | - |
183
+ | safeAreaInsetBottom | 是否开启<a href="/guide/safeAreaInset.html" target="_blank">底部安全区适配</a>| Boolean | false | true &#124; false |
184
+ | closeOnClickOverlay | 点击遮罩是否允许关闭组件 | Boolean | - | - |
185
+ | closeOnClickAction | 点击某个菜单项时是否关闭组件 | String | true | true &#124; false |
186
+ | round | 圆角值,默认无圆角 | String &#124; Number | 0 | - |
187
+ | lang | 指定返回用户信息的语言,`zh_CN` 简体中文,`zh_TW` 繁体中文,`en` 英文 | String | en | en &#124; zh_CN &#124; zh_TW &#124; |
188
+ | sessionFrom | 会话来源,`open-type="contact"`时有效。只微信小程序有效 | String | - | - |
189
+ | sendMessageTitle | 会话内消息卡片标题,`openType="contact"`时有效 | String | - | - |
190
+ | sendMessagePath | 会话内消息卡片点击跳转小程序路径,`openType="contact"`时有效 | String | - | - |
191
+ | sendMessageImg | 会话内消息卡片图片,`openType="contact"`时有效 | String | - | - |
192
+ | showMessageCard | 是否显示会话内消息卡片,设置此参数为 `true`,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,`openType="contact"`时有效| Boolean|false| true &#124; false|
193
+ | appParameter | 打开 APP 时,向 APP 传递的参数,`openType=launchApp` 时有效 | String | - | - |
194
+
195
+ ### ActionSheet Actions Props
196
+
197
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
198
+ | :- | :- | :- | :- | :- |
199
+ | openType | 小程序的打开方式 | String | '' | - |
200
+ | disabled | 该菜单是否禁用 | Boolean | false | true &#124; false |
201
+ | loading | 该菜单是否处于加载状态 | Boolean | false | true &#124; false |
202
+ | name | 该菜单的标题 | String | '' | - |
203
+ | subname | 该菜单的描述 | String | '' | - |
204
+ | fontSize | 该菜单`name`文字的大小,单位`px(rpx)` | String | 16px | - |
205
+ | color | 该菜单`name`文字的颜色 | String | #303133 | - |
206
+
207
+ ### ActionSheet Methods
208
+ | 方法名 | 说明 |
209
+ | :- | :- |
210
+ | open | 弹出操作菜单组件 | -|
211
+ | close | 关闭操作菜单组件 | -|
212
+
213
+ ### ActionSheet Events
214
+
215
+ |事件名 |说明 |回调参数 |
216
+ |:- |:- |:- |
217
+ |@select | 点击`ActionSheet`列表项时触发 | - |
218
+ |@close | 点击取消按钮时触发。点击遮罩触发该事件需要设置`:closeOnClickOverlay="true"` | - | - |
219
+ |@getuserinfo | 用户点击该按钮时,会返回获取到的用户信息,回调的 `detail` 数据与 `wx.getUserInfo` 返回的一致,`openType="getUserInfo"`时有效 | detail |
220
+ |@contact | 客服消息回调,`openType="contact"`时有效 | - |
221
+ |@getphonenumber | 获取用户手机号回调,`openType="getPhoneNumber"`时有效 | - |
222
+ |@error | 当使用开放能力时,发生错误的回调,`openType="error"`时有效 | - |
223
+ |@launchapp | 打开 APP 成功的回调,`openType="launchApp"`时有效 | - |
224
+ |@opensetting | 在打开授权设置页后回调,`openType="openSetting"`时有效 | - |
225
+
226
+ <style scoped>
227
+ h3[id=actionsheet-props] + p + table thead tr th:nth-child(2){
228
+ width: 40%;
229
+ }
230
+ h3[id=actionsheet-events] + table thead tr th:nth-child(2){
231
+ width: 50%;
232
+ }
233
+ h3[id=calendar-methods] + table thead tr th:nth-child(2){
234
+ width: 70%;
235
+ }
236
+ </style>
@@ -0,0 +1,5 @@
1
+ ## 加QQ群
2
+
3
+ #### 点击群号跳转QQ窗口:
4
+
5
+ <qq-group></qq-group>
@@ -0,0 +1,91 @@
1
+ ## Album 相册 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsC/album/album"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-album**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-album)
10
+
11
+ :::
12
+
13
+ 本组件提供一个类似相册的功能,让开发者开发起来更加得心应手,功能齐全,灵活配置可以,开箱即用。减少重复的模板代码。
14
+
15
+ ### 平台兼容性
16
+
17
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
18
+ |:-:|:-:|:-:|:-:|:-:|:-:|
19
+ |√|√|√|√|√|√|
20
+
21
+ ### 基本使用
22
+
23
+ 通过 `urls` 属性设置相册的图片地址
24
+
25
+ ```vue
26
+ <template>
27
+ <view>
28
+ <uv-album :urls="urls"></uv-album>
29
+ </view>
30
+ </template>
31
+ <script setup>
32
+ import { ref } from 'vue';
33
+
34
+ const urls = ref(['https://via.placeholder.com/400x200.png/3c9cff/fff']);
35
+
36
+ </script>
37
+ ```
38
+
39
+ ### 多图模式
40
+
41
+ - 通过 `urls` 传入更多的图片地址形成图片列表
42
+ - 通过 `multipleSize` 属性可设置图片的宽高
43
+ - 通过 `space` 属性可设置图片之间的间隙
44
+
45
+ ```vue
46
+ <template>
47
+ <view style="width: 400rpx;">
48
+ <uv-album :urls="urls" multipleSize="128rpx" space="8rpx"></uv-album>
49
+ </view>
50
+ </template>
51
+ <script setup>
52
+ import { ref } from 'vue';
53
+
54
+ const urls = ref(['https://via.placeholder.com/100x200.png/3c9cff/fff', 'https://via.placeholder.com/200x200.png/3c9cff/fff', 'https://via.placeholder.com/300x200.png/3c9cff/fff', 'https://via.placeholder.com/280x200.png/3c9cff/fff', 'https://via.placeholder.com/240x200.png/3c9cff/fff', 'https://via.placeholder.com/180x200.png/3c9cff/fff', 'https://via.placeholder.com/140x200.png/3c9cff/fff', 'https://via.placeholder.com/150x200.png/3c9cff/fff', 'https://via.placeholder.com/90x200.png/3c9cff/fff', 'https://via.placeholder.com/220x200.png/3c9cff/fff']);
55
+
56
+ </script>
57
+ ```
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
+ ### Album Props
71
+
72
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
73
+ |:- |:- |:- |:- |:- |
74
+ | urls | 图片地址列表 支持 Array\<String\> &#124; Array\<Object\>形式 | Array | - | - |
75
+ | keyName | 指定从数组的对象元素中读取哪个属性作为图片地址 | String | - | - |
76
+ | singleSize | 单图时,图片长边的长度 | String &#124; Number | 180 | - |
77
+ | multipleSize | 多图时,图片边长(宽高) | String &#124; Number | 70 | - |
78
+ | space | 多图时,图片水平和垂直之间的间隔 | String &#124; Number | 6 | - |
79
+ | singleMode | 单图时,图片缩放裁剪的模式 | String | scaleToFill | - |
80
+ | multipleMode | 多图时,图片缩放裁剪的模式 | String | aspectFill | - |
81
+ | maxCount | 最多展示的图片数量,超出时最后一个位置将会显示剩余图片数量 | String &#124; Number | 9 | - |
82
+ | previewFullImage | 是否可以预览图片 | Boolean | true | true &#124; false |
83
+ | rowCount | 每行展示图片数量,如设置,singleSize和multipleSize将会无效 | String &#124; Number | 3 | - |
84
+ | showMore | 超出maxCount时是否显示查看更多的提示 | Boolean | true | true &#124; false |
85
+
86
+
87
+ ### Album Events
88
+
89
+ |事件名 |说明 | 回调参数 |
90
+ |:- |:- |:- |
91
+ |@albumWidth |某些特殊的情况下,需要让文字与相册的宽度相等,这里事件的形式对外发送 | width |
@@ -0,0 +1,83 @@
1
+ ## Alert 警告提示 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsC/alert/alert"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-alert**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-alert)
10
+
11
+ :::
12
+
13
+ 警告提示,展现需要关注的信息。
14
+
15
+ ### 使用场景
16
+
17
+ - 当某个页面需要向用户显示警告的信息时。
18
+ - 非浮层的静态展现形式,始终展现,不会自动消失,用户可以点击关闭。
19
+
20
+ ### 平台兼容性
21
+
22
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
23
+ |:-:|:-:|:-:|:-:|:-:|:-:|
24
+ |√|√|√|√|√|√|
25
+
26
+ ### 基本使用
27
+
28
+ - 通过`title`和`description`属性设置组件的标题和描述内容
29
+ - 通过`type`属性设置主题类型,有`primary`,`success`,`error`,`warning`,`info`可选值
30
+ - 通过`effect`属性设置主题浅或深色调,有`light`(浅色 默认),`dark`(深色)可选值
31
+ ```vue
32
+ <uv-alert title="uv-ui" type="warning" description="uv-ui的目标是成为uni-app生态最优秀的UI框架"></uv-alert>
33
+ ```
34
+
35
+ ### 图标
36
+
37
+ 通过`showIcon`设置是否显示图标,作用是让信息类型更加醒目。
38
+
39
+ **注意**:当前版本图标为`uv-ui`内置图标,根据`type`参数显示不同的图标,无法自定义。
40
+
41
+ ```vue
42
+ <uv-alert type="warning" :show-icon="true"></uv-alert>
43
+ ```
44
+
45
+ ### 可关闭的警告提示
46
+
47
+ 通过`closable`属性配置是否可关闭。显示关闭按钮,点击可关闭警告提示。
48
+
49
+ ```vue
50
+ <uv-alert title="uv-ui" type="warning" description="uv-ui的目标是成为uni-app生态最优秀的UI框架" closable></uv-alert>
51
+ ```
52
+
53
+ ### 完整示例
54
+
55
+ ::: tip 完整示例下载地址
56
+
57
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
58
+
59
+ :::
60
+
61
+ ### API
62
+ ---
63
+
64
+ ### Alert Props
65
+
66
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
67
+ |:- |:- |:- |:- |:- |
68
+ | title | 显示的文字 | String | - | - |
69
+ | type | 使用预设的颜色 | String | warning | warning &#124; success &#124; primary &#124; error &#124; info |
70
+ | description | 辅助性文字,颜色比`title`浅一点,字号也小一点,可选 | String | - | - |
71
+ | closable | 关闭按钮(默认为叉号icon图标) | Boolean | false | true &#124; false |
72
+ | showIcon | 是否显示左边的辅助图标 | Boolean | false | true &#124; false |
73
+ | effect | 多图时,图片缩放裁剪的模式 | String | light(浅色) | dark(深色) &#124; light(浅色) |
74
+ | center | 文字是否居中 | Boolean | false | true &#124; false |
75
+ | fontSize | 字体大小,单位`rpx`或`px` | String &#124; Number | 14 | - |
76
+ | customStyle | 自定义外部样式 | Object | - | - |
77
+
78
+
79
+ ### Alert Events
80
+
81
+ |事件名 |说明 |回调参数 |
82
+ |:- |:- |:- |
83
+ |@click |点击组件时触发 |- |
@@ -0,0 +1,152 @@
1
+ ## Avatar 头像 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsD/avatar/avatar"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-avatar**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-avatar)
10
+
11
+ :::
12
+
13
+ 该组件一般用于展示头像的场景,如个人中心,或者评论列表页的用户头像展示等场所。
14
+
15
+ ### 平台兼容性
16
+
17
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
18
+ |:-:|:-:|:-:|:-:|:-:|:-:|
19
+ |√|√|√|√|√|√|
20
+
21
+ ### 基本使用
22
+
23
+ 通过`src`指定头像的路径即可简单使用,如果传递了`text`参数,`text`将会优先起作用
24
+
25
+ **注意:** 请保证传递给`src`的是绝对地址,而不是相对地址,为什么呢?因为传入`avatar`组件的相对地址,是相对于组件的,而不是父组件(页面),所以相对址可能会出错
26
+
27
+
28
+ ```vue
29
+ <template>
30
+ <view>
31
+ <uv-avatar src="https://via.placeholder.com/200x200.png/2878ff"></uv-avatar>
32
+ <uv-avatar text="李"></uv-avatar>
33
+ </view>
34
+ </template>
35
+ ```
36
+
37
+ ### 头像形状
38
+
39
+ `shape`参数指定头像的形状,取值`circle`为圆形,取值`square`为圆角方形,默认圆形
40
+
41
+ ```vue
42
+ <template>
43
+ <uv-avatar src="https://via.placeholder.com/200x200.png/2878ff" shape="square"></uv-avatar>
44
+ </template>
45
+ ```
46
+
47
+ ### 图标头像
48
+
49
+ 设置`icon`属性指定头像的图标,图标可参考`icon`组件
50
+
51
+ ```vue
52
+ <template>
53
+ <view>
54
+ <uv-avatar icon="red-packet-fill" fontSize="22"></uv-avatar>
55
+ <uv-avatar icon="star-fill" fontSize="22"></uv-avatar>
56
+ </view>
57
+ </template>
58
+ ```
59
+
60
+ ### 文字头像(自动背景色)
61
+
62
+ 设置`randomBgColor`属性开启头像的自动背景色
63
+
64
+ ```vue
65
+ <template>
66
+ <uv-avatar text="北" fontSize="18" randomBgColor></uv-avatar>
67
+ </template>
68
+ ```
69
+
70
+ ### 默认头像
71
+
72
+ 如果头像加载失败,导致加载图片失败,将会显示一个默认的灰色头像
73
+
74
+ ### 头像组
75
+
76
+ 使用`uv-avatar-group`实现头像组
77
+
78
+ ```vue
79
+ <template>
80
+ <uv-avatar-group :urls="urls" size="35" gap="0.4"></uv-avatar-group>
81
+ </template>
82
+ <script setup>
83
+ import { ref } from 'vue';
84
+
85
+ const urls = ref(['https://cdn.uviewui.com/uview/album/1.jpg', 'https://cdn.uviewui.com/uview/album/2.jpg', 'https://cdn.uviewui.com/uview/album/3.jpg', 'https://cdn.uviewui.com/uview/album/4.jpg', 'https://cdn.uviewui.com/uview/album/7.jpg', 'https://cdn.uviewui.com/uview/album/6.jpg', 'https://cdn.uviewui.com/uview/album/5.jpg']);
86
+
87
+ </script>
88
+ ```
89
+
90
+ ### 完整示例
91
+
92
+ ::: tip 完整示例下载地址
93
+
94
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
95
+
96
+ :::
97
+
98
+ ### API
99
+ ---
100
+
101
+ ### Avatar Props
102
+
103
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
104
+ |:- |:- |:- |:- |:- |
105
+ | src | 头像路径,如加载失败,将会显示默认头像(不能为相对路径) | String | - | - |
106
+ | shape | 头像形状 | String | circle | circle &#124; square |
107
+ | size | 头像尺寸,可以为指定字符串(large, default, mini),或者数值 | String &#124; Number | 40 | - |
108
+ | mode | 头像图片的裁剪类型,与uni的`image`组件的`mode`参数一致,如效果达不到需求,可尝试传`widthFix`值 | String | scaleToFill| - |
109
+ | text | 用文字替代图片,级别优先于`src` | String | - | - |
110
+ | bg-color | 背景颜色,一般显示文字时用 | String | #c0c4cc | - |
111
+ | color | 文字颜色 | String | #ffffff | - |
112
+ | font-size | 文字大小 | String &#124; Number | 18 | - |
113
+ | icon | 显示的图标 | String | - | - |
114
+ | mp-avatar | 显示小程序头像,只对百度,微信,QQ小程序有效 | Boolean | false | true &#124; false |
115
+ | random-bg-color | 是否使用随机背景色 | Boolean | false | true &#124; false |
116
+ | default-url | 加载失败的默认头像(组件有内置默认图片) | String | - | - |
117
+ | color-index | 如果配置了randomBgColor为true,且配置了此值,则从默认的背景色数组中取出对应索引的颜色值,取值0-19之间 | String &#124; Number | - | - |
118
+ | name | 组件标识符 | String | level | - |
119
+ | customStyle | 自定义外部样式 | Object | - | - |
120
+
121
+
122
+ ### Avatar Events
123
+
124
+ |事件名 |说明 |回调参数 |
125
+ |:- |:- |:- |
126
+ | @click | 头像被点击 | index: 用户传递的标识符 |
127
+
128
+ ### AvatarGroup Props
129
+
130
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
131
+ |:- |:- |:- |:- |:- |
132
+ | urls | 头像图片组 | Array | [] | - |
133
+ | maxCount | 最多展示的头像数量 | String &#124; Number | 5 | - |
134
+ | shape | 头像形状 | String | circle | circle &#124; square |
135
+ | mode | 图片裁剪模式 | String | aspectFill| - |
136
+ | showMore | 超出maxCount时是否显示查看更多的提示 | Boolean | true | - |
137
+ | size | 头像大小 | String &#124; Number | 40 | - |
138
+ | keyName | 指定从数组的对象元素中读取哪个属性作为图片地址 | String | - | - |
139
+ | gap | 头像之间的遮挡比例(0.4代表遮挡40%) | String &#124; Number | 0.5 | - |
140
+ | extraValue | 需额外显示的值,如设置则优先于内部的`urls.length - maxCount`值 | String &#124; Number | - | - |
141
+
142
+ ### AvatarGroup Events
143
+
144
+ |事件名 |说明 |回调参数 |
145
+ |:- |:- |:- |
146
+ | @showMore | 头像组更多点击 | - |
147
+
148
+ <style scoped>
149
+ h3[id=avatargroup-props] + table thead tr th:nth-child(2){
150
+ width: 35%;
151
+ }
152
+ </style>