@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.
Files changed (135) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +95 -141
  4. package/docs/api/configs/color.md +52 -0
  5. package/docs/api/index.md +77 -0
  6. package/docs/api/mixins/mpShare.md +95 -0
  7. package/docs/api/request/apiManage.md +88 -0
  8. package/docs/api/request/http.md +451 -0
  9. package/docs/api/utils/colorSwitch.md +78 -0
  10. package/docs/api/utils/debounce.md +104 -0
  11. package/docs/api/utils/fastUse.md +246 -0
  12. package/docs/api/utils/getRect.md +238 -0
  13. package/docs/api/utils/guid.md +41 -0
  14. package/docs/api/utils/index.md +55 -0
  15. package/docs/api/utils/intro.md +25 -0
  16. package/docs/api/utils/object.md +171 -0
  17. package/docs/api/utils/queryParams.md +68 -0
  18. package/docs/api/utils/random.md +23 -0
  19. package/docs/api/utils/randomArray.md +28 -0
  20. package/docs/api/utils/route.md +121 -0
  21. package/docs/api/utils/test.md +237 -0
  22. package/docs/api/utils/time.md +81 -0
  23. package/docs/api/utils/trim.md +24 -0
  24. package/docs/components/actionSheet.md +236 -0
  25. package/docs/components/addQQGroup.md +5 -0
  26. package/docs/components/album.md +91 -0
  27. package/docs/components/alert.md +83 -0
  28. package/docs/components/avatar.md +152 -0
  29. package/docs/components/backTop.md +181 -0
  30. package/docs/components/badge.md +117 -0
  31. package/docs/components/button.md +196 -0
  32. package/docs/components/calendar.md +398 -0
  33. package/docs/components/calendars.md +294 -0
  34. package/docs/components/cell.md +185 -0
  35. package/docs/components/checkbox.md +281 -0
  36. package/docs/components/circleProgress.md +5 -0
  37. package/docs/components/code.md +162 -0
  38. package/docs/components/codeInput.md +175 -0
  39. package/docs/components/collapse.md +250 -0
  40. package/docs/components/color.md +324 -0
  41. package/docs/components/common.md +126 -0
  42. package/docs/components/countDown.md +166 -0
  43. package/docs/components/countTo.md +140 -0
  44. package/docs/components/datetimePicker.md +283 -0
  45. package/docs/components/diff1.x.md +190 -0
  46. package/docs/components/divider.md +88 -0
  47. package/docs/components/downloadSetting.md +54 -0
  48. package/docs/components/dropDown.md +375 -0
  49. package/docs/components/empty.md +99 -0
  50. package/docs/components/feature.md +261 -0
  51. package/docs/components/form.md +736 -0
  52. package/docs/components/gap.md +49 -0
  53. package/docs/components/grid.md +225 -0
  54. package/docs/components/icon.md +101 -0
  55. package/docs/components/image.md +182 -0
  56. package/docs/components/index.md +110 -0
  57. package/docs/components/indexList.md +133 -0
  58. package/docs/components/input.md +250 -0
  59. package/docs/components/install.md +59 -0
  60. package/docs/components/intro.md +32 -0
  61. package/docs/components/keyboard.md +226 -0
  62. package/docs/components/layout.md +310 -0
  63. package/docs/components/line.md +85 -0
  64. package/docs/components/lineProgress.md +141 -0
  65. package/docs/components/link.md +89 -0
  66. package/docs/components/list.md +223 -0
  67. package/docs/components/loadMore.md +140 -0
  68. package/docs/components/loadingIcon.md +144 -0
  69. package/docs/components/loadingPage.md +92 -0
  70. package/docs/components/modal.md +230 -0
  71. package/docs/components/more.md +13 -0
  72. package/docs/components/navbar.md +192 -0
  73. package/docs/components/noNetwork.md +116 -0
  74. package/docs/components/noticeBar.md +131 -0
  75. package/docs/components/notify.md +204 -0
  76. package/docs/components/npmSetting.md +64 -0
  77. package/docs/components/numberBox.md +257 -0
  78. package/docs/components/nvue.md +170 -0
  79. package/docs/components/overlay.md +117 -0
  80. package/docs/components/parse.md +204 -0
  81. package/docs/components/pickColor.md +112 -0
  82. package/docs/components/picker.md +357 -0
  83. package/docs/components/popup.md +221 -0
  84. package/docs/components/problem.md +300 -0
  85. package/docs/components/qrcode.md +169 -0
  86. package/docs/components/quickstart.md +33 -0
  87. package/docs/components/radio.md +256 -0
  88. package/docs/components/rate.md +128 -0
  89. package/docs/components/read.md +163 -0
  90. package/docs/components/readMore.md +227 -0
  91. package/docs/components/resource.md +17 -0
  92. package/docs/components/scrollList.md +218 -0
  93. package/docs/components/search.md +160 -0
  94. package/docs/components/setting.md +111 -0
  95. package/docs/components/settingDesc.md +66 -0
  96. package/docs/components/skeleton.md +105 -0
  97. package/docs/components/skeletons.md +323 -0
  98. package/docs/components/slider.md +157 -0
  99. package/docs/components/steps.md +189 -0
  100. package/docs/components/sticky.md +76 -0
  101. package/docs/components/subsection.md +183 -0
  102. package/docs/components/swipeAction.md +279 -0
  103. package/docs/components/swiper.md +352 -0
  104. package/docs/components/switch.md +216 -0
  105. package/docs/components/tabbar.md +263 -0
  106. package/docs/components/table.md +5 -0
  107. package/docs/components/tabs.md +364 -0
  108. package/docs/components/tag.md +227 -0
  109. package/docs/components/testPic.md +20 -0
  110. package/docs/components/text.md +157 -0
  111. package/docs/components/textarea.md +121 -0
  112. package/docs/components/toast.md +124 -0
  113. package/docs/components/tooltip.md +98 -0
  114. package/docs/components/transition.md +404 -0
  115. package/docs/components/upload.md +253 -0
  116. package/docs/components/vtabs.md +332 -0
  117. package/docs/components/vueUse.md +45 -0
  118. package/docs/components/vuexDetail.md +103 -0
  119. package/docs/components/waterfall.md +651 -0
  120. package/docs/faq/index.md +53 -0
  121. package/docs/guide/codeHint.md +44 -0
  122. package/docs/guide/customIcon.md +168 -0
  123. package/docs/guide/demo.md +92 -0
  124. package/docs/guide/design.md +56 -0
  125. package/docs/guide/globalVariable.md +239 -0
  126. package/docs/guide/i18n.md +194 -0
  127. package/docs/guide/index.md +28 -0
  128. package/docs/guide/note.md +74 -0
  129. package/docs/guide/safeAreaInset.md +64 -0
  130. package/docs/guide/theme.md +67 -0
  131. package/docs/index.md +88 -0
  132. package/libs/config/config.js +0 -10
  133. package/libs/css/color.scss +15 -14
  134. package/package.json +7 -2
  135. package/theme.scss +2 -1
@@ -0,0 +1,185 @@
1
+ ## Cell 单元格 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsC/cell/cell"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-cell**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-cell)
10
+
11
+ :::
12
+
13
+ cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。
14
+
15
+ ### 平台兼容性
16
+
17
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
18
+ |:-:|:-:|:-:|:-:|:-:|:-:|
19
+ |√|√|√|√|√|√|
20
+
21
+ ### 基础功能
22
+
23
+ - 该组件需要搭配`cell-group`使用,并由它实现列表组的上下边框,如不需要上下边框,配置`cellGroup`的`border`参数为`false`即可
24
+ - 通过`title`设置左侧标题,`value`设置右侧内容
25
+ - 通过`icon`字段设置图标,或者图片链接(本地文件建议使用绝对地址)
26
+
27
+ ```vue
28
+ <template>
29
+ <uv-cell-group>
30
+ <uv-cell icon="setting-fill" title="个人设置"></uv-cell>
31
+ <uv-cell icon="integral-fill" title="版本更新" value="已是新版本"></uv-cell>
32
+ </uv-cell-group>
33
+ </template>
34
+ ```
35
+
36
+ ### 通过slot自定义内容
37
+
38
+ - 通过插槽`title`自定义左边标题部分
39
+ - 通过插槽`label`自定义左侧标题下面描述内容
40
+ - 通过插槽`value`自定义右侧值
41
+ - 通过插槽`icon`自定义左侧图标
42
+ - 通过插槽`right-icon`自定义右侧图标
43
+
44
+ ```vue
45
+ <template>
46
+ <uv-cell-group>
47
+ <uv-cell>
48
+ <!-- 自定义左侧标题 -->
49
+ <template v-slot:title>
50
+ <text>检查版本</text>
51
+ </template>
52
+ <!-- 自定义左侧标题下面的内容 -->
53
+ <template v-slot:label>
54
+ <text style="font-size: 28rpx;color: #999;">点击我检查新版本</text>
55
+ </template>
56
+ <!-- 自定义右侧值 -->
57
+ <template v-slot:value>
58
+ <text>已是最新版</text>
59
+ </template>
60
+ <!-- 自定义左侧图标 -->
61
+ <template v-slot:icon>
62
+ <uv-icon size="50rpx" name="search"></uv-icon>
63
+ </template>
64
+ <!-- 自定义右侧图标 -->
65
+ <template v-slot:right-icon>
66
+ <uv-icon size="30rpx" name="arrow-right"></uv-icon>
67
+ </template>
68
+ </uv-cell>
69
+ </uv-cell-group>
70
+ </template>
71
+ ```
72
+
73
+ ### 展示右箭头
74
+
75
+ 设置`isLink`为`true`,将会显示右侧的箭头,可以通过`arrow-direction`控制箭头的方向:`left` `right` `up` `down`
76
+
77
+ ```vue
78
+ <template>
79
+ <uv-cell-group>
80
+ <uv-cell icon="share" title="明月几时有" :isLink="true" arrow-direction="down"></uv-cell>
81
+ <uv-cell icon="map" title="把酒问青天" :isLink="false"></uv-cell>
82
+ </uv-cell-group>
83
+ </template>
84
+ ```
85
+ ### 跳转页面
86
+
87
+ 设置`isLink`为`true`,单元格点击可跳转页面,传入`url`设置跳转地址
88
+
89
+ ```vue
90
+ <template>
91
+ <uv-cell-group>
92
+ <uv-cell title="打开标签页" isLink url="/pages/componentsD/tag/tag"></uv-cell>
93
+ <uv-cell title="打开徽标页" isLink url="/pages/componentsD/badge/badge"></uv-cell>
94
+ </uv-cell-group>
95
+ </template>
96
+ ```
97
+ ### 右侧内容垂直居中
98
+
99
+ 通过`center`属性设置一个布尔值,可将设置右侧`value`内容是否垂直居中,默认`true`
100
+
101
+ ```vue
102
+ <template>
103
+ <uv-cell-group>
104
+ <uv-cell title="单元格" value="内容" label="描述信息" :center="true"></uv-cell>
105
+ </uv-cell-group>
106
+ </template>
107
+ ```
108
+
109
+ ### 完整示例
110
+
111
+ ::: tip 完整示例下载地址
112
+
113
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
114
+
115
+ :::
116
+
117
+ ### API
118
+ ---
119
+
120
+ ### CellGroup Props
121
+
122
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
123
+ | :- | :- | :- | :- | :- |
124
+ | title | 分组标题 | String | - | - |
125
+ | border | 是否显示分组标题的下边框 | Boolean | true | true &#124; false |
126
+ | customStyle | 用户自定义外部样式 | object | - | - |
127
+
128
+ ### Cell Props
129
+
130
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
131
+ | :- | :- | :- | :- | :- |
132
+ | title | 左侧标题 | String &#124; Number | - | - |
133
+ | label | 标题下方的描述信息 | String &#124; Number | - | - |
134
+ | value | 右侧的内容 | String &#124; Number | - | - |
135
+ | icon | 左侧图标名称,或者图片链接(本地文件建议使用绝对地址) | String | - | - |
136
+ | disabled | 是否禁用cell | Boolean | false | true &#124; false |
137
+ | border | 是否显示下边框 | Boolean | true | true &#124; false |
138
+ | center | 内容是否垂直居中(主要是针对右侧的value部分) | Boolean | false | true &#124; false |
139
+ | url | 点击后跳转的URL地址 | String | - | - |
140
+ | linkType | 链接跳转的方式,内部使用的是uv-ui封装的route方法,可能会进行拦截操作 | String | navigateTo | - |
141
+ | clickable | 是否开启点击反馈(表现为点击时加上灰色背景)| Boolean | false | true &#124; false |
142
+ | isLink | 是否展示右侧箭头并开启点击反馈 | Boolean | false | true &#124; false |
143
+ | required | 是否显示表单状态下的必填星号(此组件可能会内嵌入input组件) | Boolean | false | true &#124; false |
144
+ | rightIcon | 右侧的图标箭头 | String | arrow-right | - |
145
+ | arrowDirection| 右侧箭头的方向,可选值为:`left` `up` `down` | String | right | left &#124; up &#124; down|
146
+ | iconStyle | 左侧图标样式 | Object &#124; String | - | - |
147
+ | rightIconStyle| 右侧箭头图标的样式 | Object &#124; String | - | - |
148
+ | titleStyle | 标题的样式 | Object &#124; String | - | - |
149
+ | size | 单位元的大小,可选值为large | String | - | large &#124; normal |
150
+ | stop | 点击cell是否阻止事件传播 | Boolean | true | true &#124; false |
151
+ | name | 标识符,用于在`click`事件中进行返回 | String &#124; Number | - | - |
152
+ | cellStyle | 自定义单元格样式,如:设置padding等样式。**如果想在isLink为true状态下不表现出点击态,可以使用此属性设置背景颜色** | Object &#124; String | - | - |
153
+ | customStyle | 自定义外部样式,如:设置边框等样式 | Object &#124; String | - | - |
154
+
155
+
156
+ ### Cell Slots
157
+
158
+ | 名称 | 说明 |
159
+ | :- | :- |
160
+ | title | 自定义左侧标题部分的内容,如需使用,请勿定义`title`参数,或赋值`null`即可 |
161
+ | value | 自定义右侧内容,如需使用,请勿定义`value`参数,或赋值`null`即可 |
162
+ | icon | 自定义左侧的图标 |
163
+ | right-icon| 自定义右侧图标内容,需设置`arrow`为`false`才起作用 |
164
+ | label | 自定义标题下方的描述内容 |
165
+
166
+ ### Cell Events
167
+
168
+ | 事件名 | 说明 | 回调参数 |
169
+ | :- | :- | :- |
170
+ | @click | 点击cell列表时触发 | name: `props`的`name`参数标识符 |
171
+
172
+ <style scoped>
173
+ h3[id=cell-props] + table thead tr th:nth-child(2){
174
+ width: 40%;
175
+ }
176
+ h3[id=cell-slots] + table thead tr th:nth-child(2){
177
+ width: 70%;
178
+ }
179
+ h3[id=cell-events] + table thead tr th:nth-child(2){
180
+ width: 40%;
181
+ }
182
+ h3[id=cell-events] + table thead tr th:nth-child(4){
183
+ width: 40%;
184
+ }
185
+ </style>
@@ -0,0 +1,281 @@
1
+ ## Checkbox 复选框 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsB/checkbox/checkbox"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-checkbox-group > uv-checkbox**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-checkbox)
10
+
11
+ :::
12
+
13
+ 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便
14
+
15
+ ### 平台兼容性
16
+
17
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
18
+ |:-:|:-:|:-:|:-:|:-:|:-:|
19
+ |√|√|√|√|√|√|
20
+
21
+ ### 基本使用
22
+
23
+ - 该组件需要搭配`checkboxGroup`组件使用,以便用户进行操作时,获得当前复选框组的选中情况。
24
+ - 通过`v-model`给`checkboxGroup`组件绑定一个变量,对应的`name`将会被选中。
25
+
26
+ ```vue
27
+ <template>
28
+ <view>
29
+ <uv-checkbox-group v-model="checkboxValue">
30
+ <uv-checkbox
31
+ :customStyle="{marginBottom: '8px'}"
32
+ v-for="(item, index) in checkboxList"
33
+ :key="index" :label="item.name"
34
+ :name="item.name"
35
+ ></uv-checkbox>
36
+ </uv-checkbox-group>
37
+ </view>
38
+ </template>
39
+ <script setup>
40
+ import { ref } from 'vue';
41
+
42
+ const checkboxValue = ref(['苹果']);
43
+ const checkboxList = ref([{
44
+ name: '苹果',
45
+ disabled: false
46
+ }, {
47
+ name: '香蕉',
48
+ disabled: false
49
+ }, {
50
+ name: '橙子',
51
+ disabled: false
52
+ }]);
53
+
54
+ </script>
55
+ ```
56
+ ### 自定义形状
57
+
58
+ 可以通过设置`shape`为`square`或者`circle`,将复选框设置为方形或者圆形
59
+
60
+ ```vue
61
+ <template>
62
+ <view>
63
+ <uv-checkbox-group
64
+ v-model="checkboxValue"
65
+ shape="circle">
66
+ <uv-checkbox
67
+ :customStyle="{marginBottom: '8px'}"
68
+ v-for="(item, index) in checkboxList"
69
+ :key="index" :label="item.name"
70
+ :name="item.name"
71
+ ></uv-checkbox>
72
+ </uv-checkbox-group>
73
+ </view>
74
+ </template>
75
+ <script setup>
76
+ import { ref } from 'vue';
77
+
78
+ const checkboxValue = ref(['苹果']);
79
+ const checkboxList = ref([{
80
+ name: '苹果',
81
+ disabled: false
82
+ }, {
83
+ name: '香蕉',
84
+ disabled: false
85
+ }, {
86
+ name: '橙子',
87
+ disabled: false
88
+ }]);
89
+
90
+ </script>
91
+ ```
92
+
93
+ ### 禁用checkbox
94
+
95
+ 设置`disabled`为`true`,即可禁用某个组件,让用户无法点击,禁用分为两种状态,一是未勾选前禁用,这时只显示一个灰色的区域。二是已勾选后
96
+ 再禁用,会有灰色的已勾选的图标,但此时依然是不可操作的。
97
+
98
+ ```vue
99
+ <template>
100
+ <view>
101
+ <uv-checkbox-group
102
+ v-model="checkboxValue"
103
+ shape="circle">
104
+ <uv-checkbox
105
+ :customStyle="{marginBottom: '8px'}"
106
+ v-for="(item, index) in checkboxList"
107
+ :key="index" :label="item.name"
108
+ :name="item.name"
109
+ :disabled="index===0"
110
+ ></uv-checkbox>
111
+ </uv-checkbox-group>
112
+ </view>
113
+ </template>
114
+ <script setup>
115
+ import { ref } from 'vue';
116
+
117
+ const checkboxValue = ref(['苹果']);
118
+ const checkboxList = ref([{
119
+ name: '苹果',
120
+ disabled: false
121
+ }, {
122
+ name: '香蕉',
123
+ disabled: false
124
+ }, {
125
+ name: '橙子',
126
+ disabled: false
127
+ }]);
128
+
129
+ </script>
130
+ ```
131
+
132
+ ### 自定义颜色
133
+
134
+ 此处所指的颜色,为`checkbox`选中时的背景颜色,参数为`activeColor`
135
+
136
+ ```vue
137
+ <template>
138
+ <view>
139
+ <uv-checkbox-group v-model="checkboxValue">
140
+ <uv-checkbox activeColor="red" name="apple" label="苹果"></uv-checkbox>
141
+ </uv-checkbox-group>
142
+ </view>
143
+ </template>
144
+ <script setup>
145
+ import { ref } from 'vue';
146
+
147
+ const checkboxValue = ref(['apple']);
148
+
149
+ </script>
150
+ ```
151
+
152
+ ### 横向排列形式
153
+
154
+ 可以通过设置`placement`为`row`或者`column`,将复选框设置为横向排列或者竖向排列
155
+
156
+ ```vue
157
+ <template>
158
+ <view>
159
+ <uv-checkbox-group v-model="checkboxValue" placement="column">
160
+ <uv-checkbox name="apple" label="苹果"></uv-checkbox>
161
+ <uv-checkbox name="banana" label="香蕉"></uv-checkbox>
162
+ </uv-checkbox-group>
163
+ </view>
164
+ </template>
165
+ <script setup>
166
+ import { ref } from 'vue';
167
+
168
+ const checkboxValue = ref(['apple']);
169
+
170
+ </script>
171
+ ```
172
+
173
+ ### 横向两端排列形式
174
+
175
+ 在`placement="column"`前提下,可以通过设置`iconPlacement`为`left`或者`right`,将复选框勾选图标的对齐设置为左对齐或者右对齐。
176
+
177
+ ```vue
178
+ <template>
179
+ <view>
180
+ <uv-checkbox-group
181
+ v-model="checkboxValue"
182
+ iconPlacement="right"
183
+ placement="column">
184
+ <uv-checkbox name="apple" label="苹果"></uv-checkbox>
185
+ <uv-checkbox name="banana" label="香蕉"></uv-checkbox>
186
+ </uv-checkbox-group>
187
+ </view>
188
+ </template>
189
+ <script setup>
190
+ import { ref } from 'vue';
191
+
192
+ const checkboxValue = ref(['apple']);
193
+
194
+ </script>
195
+ ```
196
+
197
+ ### 完整示例
198
+
199
+ ::: tip 完整示例下载地址
200
+
201
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
202
+
203
+ :::
204
+
205
+ ### API
206
+ ---
207
+
208
+ ### CheckboxGroup Props
209
+
210
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
211
+ | :- | :- | :- | :- | :- |
212
+ | value / v-model | 选中name的值,eg:['a','b'] | Array | [] | - |
213
+ | value | 绑定的值 | Array | [] | - |
214
+ | shape | 形状,circle-圆形,square-方形 | String | square | square &#124; circle|
215
+ | disabled | 是否禁用全部checkbox | Boolean | false | true &#124; false |
216
+ | activeColor | 选中状态下的颜色,如子`Checkbox`组件设置此值,将会覆盖本值 | String | #2979ff | - |
217
+ | inactiveColor | 未选中的颜色 | String | #c8c9cc | - |
218
+ | size | 整个组件的尺寸,默认px。**注意:该参数和iconSize应该同步设置,才能改变选框大小** | String | 18 | - |
219
+ | placement | 布局方式,row-横向,column-纵向 | String | row | row &#124; column|
220
+ | labelSize | label的字体大小,单位 `px(rpx)` | String &#124; Number | 14 | - |
221
+ | labelColor | label的字体颜色 | String | #303133 | - |
222
+ | labelDisabled | 是否禁止点击文本操作 | Boolean | false | true &#124; false |
223
+ | iconColor | 图标颜色 | String | #ffffff | - |
224
+ | iconSize | 图标的大小,单位 `px(rpx)` | String &#124; Number | 12 | - |
225
+ | iconPlacement | 勾选图标的对齐方式,left-左边,right-右边 | String | left | left &#124; right |
226
+ | borderBottom | 竖向配列时,是否显示下划线 | Boolean | false | true &#124; false |
227
+ | customStyle | 自定义样式,某些事件需要用到调整位置等作用 | Object | - | - |
228
+
229
+ ### Checkbox Props
230
+
231
+ 注意:`checkbox`和`checkbox-group`二者同名参数中,`checkbox`的参数优先级更高。
232
+
233
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
234
+ | :- | :- | :- | :- | :- |
235
+ | name | checkbox的名称 | String &#124; Number &#124; Boolean | - | - |
236
+ | shape | 形状,square为方形,circle为圆型 | String | square| square &#124; circle|
237
+ | size | 整体的大小 | String &#124; Number | - | - |
238
+ | checked | 是否默认选中 | Boolean | false | true &#124; false |
239
+ | disabled | 是否禁用 | String &#124; Boolean | - | - |
240
+ | activeColor | 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 | String | - | - |
241
+ | inactiveColor | 未选中的颜色 | String | - | - |
242
+ | iconSize | 图标的大小,单位px | String &#124; Number | - | - |
243
+ | iconColor | 图标颜色 | String | - | - |
244
+ | label | label提示文字。如果文本较长存在文本不换行的问题,使用customStyle设置一个宽度即可,eg:`customStyle="maxWidth: 300rpx;"` | String &#124; Number | - | - |
245
+ | labelSize | label的字体大小,px单位 | String &#124; Number | - | - |
246
+ | labelColor | label的颜色 | String | - | - |
247
+ | labelDisabled | 是否禁止点击提示语选中复选框 | String &#124; Boolean | - | - |
248
+ | customStyle | 自定义样式 | Object &#124; String | - | - |
249
+
250
+ ### Checkbox Slots
251
+
252
+ | 名称 | 说明 |
253
+ |:- |:- |
254
+ | default | 自定义`label`内容,自定义后,`labelDisabled`设置将会失效 |
255
+ | icon | 自定义选中图标 |
256
+
257
+ ### CheckboxGroup Events
258
+
259
+ | 事件名 | 说明 | 回调参数 |
260
+ | :- | :- | :- |
261
+ | @change| 任一个`checkbox`状态发生变化时触发,回调为一个对象 | detail = array( [元素为被选中的`checkbox`的`name`] ) |
262
+
263
+ ### Checkbox Events
264
+
265
+ | 事件名 | 说明 | 回调参数 |
266
+ | :- | :- | :- |
267
+ | @change| 某个`checkbox`状态发生变化时触发(选中状态) | name: 通过`props`传递的`name`参数 |
268
+
269
+ <style scoped>
270
+ h3[id=checkbox-slots] + table thead tr th:nth-child(2){
271
+ width: 70%;
272
+ }
273
+ h3[id=checkboxgroup-events] + table thead tr th:nth-child(2),
274
+ h3[id=checkbox-events] + table thead tr th:nth-child(2) {
275
+ width: 40%;
276
+ }
277
+ h3[id=checkboxgroup-events] + table thead tr th:nth-child(3),
278
+ h3[id=checkbox-events] + table thead tr th:nth-child(3) {
279
+ width: 40%;
280
+ }
281
+ </style>
@@ -0,0 +1,5 @@
1
+ ## CircleProgress 圆形进度条 <to-api/>
2
+
3
+ :::warning 温馨提示
4
+ 暂无
5
+ :::
@@ -0,0 +1,162 @@
1
+ ## Code 验证码倒计时 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsB/code/code"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-code**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-code)
10
+
11
+ :::
12
+
13
+ 考虑到用户实际发送验证码的场景,可能是一个按钮,也可能是一段文字,提示语各有不同,所以本组件不提供界面显示,只提供倒计时文本,由用户将文本嵌入到具体的场景。
14
+
15
+ ### 平台兼容性
16
+
17
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
18
+ |:-:|:-:|:-:|:-:|:-:|:-:|
19
+ |√|√|√|√|√|√|
20
+
21
+ ### 基本使用
22
+
23
+ 通过ref获取组件对象,再执行后面的操作,见下方示例。
24
+
25
+ 1. 通过`seconds`设置需要倒计的秒数(默认`60`)
26
+ 2. 通过ref调用组件内部的`start`方法,开始倒计时
27
+ 3. 通过监听`change`事件(从开始到结束之间,每秒触发一次)获得提示的文字,可能值如"获取验证码|12秒后重新获取|重新获取",可以自定义
28
+
29
+ 注意:用户可能在倒计时的过程中点击获取验证码的按钮,组件内部提供了通过ref获取的`canGetCode`变量,在倒计时
30
+ 过程中,该值为`false`,如果为`false`应该给予提示并不要再次向后端请求验证码,如果为`true`,则为获取验证码
31
+ 之前,或者倒计结束之后,可以再次向后端请求验证码。
32
+
33
+ 以下为完整示例,见如下:
34
+
35
+ ```vue
36
+ <template>
37
+ <view class="wrap">
38
+ <uv-toast ref="toast"></uv-toast>
39
+ <uv-code :seconds="seconds" @end="end" @start="start" ref="code" @change="codeChange"></uv-code>
40
+ <uv-button @tap="getCode">{{tips}}</uv-button>
41
+ </view>
42
+ </template>
43
+ <script setup>
44
+ import { ref } from 'vue';
45
+
46
+ const toast = ref(null);
47
+ const code = ref(null);
48
+ const tips = ref('');
49
+ const seconds = ref(10);
50
+ function codeChange(text) {
51
+ tips.value = text;
52
+ }
53
+ function getCode() {
54
+ if (code.value.canGetCode) {
55
+ // 模拟向后端请求验证码
56
+ uni.showLoading({
57
+ title: '正在获取验证码'
58
+ });
59
+ setTimeout(() => {
60
+ uni.hideLoading();
61
+ // 这里此提示会被start()方法中的提示覆盖
62
+ uni.$uv.toast('验证码已发送');
63
+ // 通知验证码组件内部开始倒计时
64
+ code.value.start();
65
+ }, 2000);
66
+ } else {
67
+ uni.$uv.toast('倒计时结束后再发送');
68
+ }
69
+ }
70
+ function end() {
71
+ uni.$uv.toast('倒计时结束');
72
+ }
73
+ function start() {
74
+ uni.$uv.toast('倒计时开始');
75
+ }
76
+
77
+ </script>
78
+ <style lang="scss">
79
+ .wrap {
80
+ padding: 24rpx;
81
+ }
82
+ </style>
83
+ ```
84
+ ::: warning 温馨提示
85
+ 使用uni上挂载的uv-ui内置方法,需要根据[扩展配置 - JS工具库](/components/setting.html)进行相应的配置,否则直接会报错!
86
+ :::
87
+
88
+ ### 自定义提示语
89
+
90
+ 组件内部有内置的提示语,如获取验证码前的提示语为"获取验证码",用户可以通过参数配置自定义的提示:
91
+ - 获取前,参数为`start-text`,默认值为"获取验证码"
92
+ - 倒计时期间,参数为`change-text`,默认为"X秒重新获取",这里的"x"(大小写均可),将会被倒计的秒数替代
93
+ - 倒计时结束,参数为`end-text`,默认值为"重新获取"
94
+
95
+
96
+ ### 保持倒计时
97
+
98
+ 一般情况下,在H5刷新浏览器,或者各端返回再进入时,倒计时会消失,导致用户可以再次尝试获取验证码,虽然后端还会对此进行进一步的判断。
99
+ 对于这种情况,uv-ui给出了一个`keep-running`参数(默认为`false`),为`true`的时候,即使刷新浏览器,或者返回上一个页面,
100
+ 倒计时依然会继续(如果还在倒计时间内的话)。
101
+
102
+ **注意:** 如果您的一个页面或者多个页面同时使用了多个此组件,为了防止多个组件之间,保存在本地的多个继续倒计时的变量之间互相干扰,可以配置
103
+ 各个组件的`unique-key`为一个不重复的字符串,以作区分:
104
+
105
+ ```vue
106
+ /* A.vue */
107
+ <uv-code unique-key="page-a"></uv-code>
108
+
109
+ /* B.vue */
110
+ <uv-code unique-key="page-b"></uv-code>
111
+ ```
112
+
113
+ ### 完整示例
114
+
115
+ ::: tip 完整示例下载地址
116
+
117
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
118
+
119
+ :::
120
+
121
+ ### API
122
+ ---
123
+
124
+ ### Code Props
125
+
126
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
127
+ |:- |:- |:- |:- |:- |
128
+ | seconds | 倒计时所需的秒数 | Number &#124; String | 60 | - |
129
+ | startText | 开始前的提示语,见上方说明 | String | 获取验证码 | - |
130
+ | changeText | 倒计时期间的提示语,必须带有字母"x",见上方说明 | String | X秒重新获取 | - |
131
+ | endText | 倒计结束的提示语,见上方说明 | String | 重新获取 | - |
132
+ | keepRunning | 是否在H5刷新或各端返回再进入时继续倒计时 | Boolean | false | true &#124; false |
133
+ | uniqueKey | 多个组件之间继续倒计时的区分`key`,见上方说明 | String | - | - |
134
+
135
+
136
+ ### Code Methods
137
+
138
+ 需要通过ref获取验证码组件才能调用,见上方"基本使用"说明
139
+
140
+
141
+ | 名称 | 说明 |
142
+ | :- |:- |
143
+ | start | 开始倒计时 |
144
+ | reset | 结束当前正在进行中的倒计时,设置组件为可以重新获取验证码的状态 |
145
+
146
+
147
+ ### Code Events
148
+
149
+ |事件名 |说明 |回调参数 |
150
+ |:- |:- |:- |
151
+ | @change| 倒计时期间,每秒触发一次 | text: 当前剩余多少秒的状态,见上方说明 |
152
+ | @start | 开始倒计时触发 | - |
153
+ | @end | 结束倒计时触发 | - |
154
+
155
+
156
+
157
+ <style scoped>
158
+
159
+ h3[id=code-methods] + p + table thead tr th:nth-child(2){
160
+ width: 70%;
161
+ }
162
+ </style>