@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,257 @@
1
+ ## NumberBox 步进器 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsB/numberBox/numberBox"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-number-box**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-number-box)
10
+
11
+ :::
12
+
13
+ 该组件一般用于商城购物选择物品数量的场景
14
+
15
+ 注意:该输入框只能输入大于或等于0的整数
16
+
17
+ ### 平台兼容性
18
+
19
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
20
+ |:-:|:-:|:-:|:-:|:-:|:-:|
21
+ |√|√|√|√|√|√|
22
+
23
+ ### 基本使用
24
+
25
+ 通过`v-model`绑定`value`初始值,此值是双向绑定的,**无需**在回调中将返回的数值重新赋值给`value`。
26
+
27
+ ```vue
28
+ <template>
29
+ <uv-number-box v-model="value" @change="valChange"></uv-number-box>
30
+ </template>
31
+ <script setup>
32
+ import { ref } from 'vue';
33
+
34
+ const value = ref(0);
35
+ function valChange(e) {
36
+ console.log('当前值为: ' + e.value);
37
+ }
38
+
39
+ </script>
40
+ ```
41
+
42
+ ### 步长设置
43
+
44
+ - 通过`step`属性设置每次点击增加或减少按钮时变化的值,默认为1,下面示例每次都会加2或者减2
45
+
46
+ ```vue
47
+ <uv-number-box :step="2"></uv-number-box>
48
+ ```
49
+
50
+ ### 限制输入范围
51
+
52
+ 通过`min`和`max`参数限制输的入值最小值和最大值
53
+
54
+ ```vue
55
+ <uv-number-box :min="1" :max="100"></uv-number-box>
56
+ ```
57
+
58
+ ### 限制只能输入整数
59
+
60
+ 通过`integer`限制输入类型
61
+
62
+ ```vue
63
+ <uv-number-box integer></uv-number-box>
64
+ ```
65
+
66
+ ### 禁用
67
+
68
+ ```vue
69
+ <!-- 通过设置`disabled`参数来禁用输入框,禁用状态下无法点击加减按钮或修改输入框的值 -->
70
+ <uv-number-box :disabled="true"></uv-number-box>
71
+
72
+ <!-- 禁用输入框 -->
73
+ <uv-number-box :disabledInput="true"></uv-number-box>
74
+
75
+ <!-- 禁用增加按钮 -->
76
+ <uv-number-box :disablePlus="true"></uv-number-box>
77
+
78
+ <!-- 禁用减少按钮 -->
79
+ <uv-number-box :disableMinus="true"></uv-number-box>
80
+
81
+ <!-- 禁用长按 -->
82
+ <uv-number-box :longPress="false"></uv-number-box>
83
+ ```
84
+
85
+ ### 固定小数位数
86
+
87
+ 通过`step`设置步进长度,`decimal-length`设置显示小数位数
88
+
89
+ ```vue
90
+ <uv-number-box step="0.25" decimal-length="1" ></uv-number-box>
91
+ ```
92
+
93
+ ### 异步变更
94
+
95
+ 通过`asyncChange`设置异步变更,开启后需要手动控制输入值 (默认 `false` )
96
+
97
+ ```vue
98
+ <template>
99
+ <uv-number-box v-model="value" :asyncChange="true" @change="onChange"></uv-number-box>
100
+ </template>
101
+ <script setup>
102
+ import { ref } from 'vue';
103
+
104
+ const value = ref(1);
105
+ function onChange(e) {
106
+ uni.showLoading({
107
+ title: '加载中',
108
+ mask: true
109
+ });
110
+ setTimeout(() => {
111
+ value.value = value.value + 1;
112
+ uni.hideLoading();
113
+ }, 1000);
114
+ }
115
+
116
+ </script>
117
+ ```
118
+
119
+ ### 自定义颜色和大小
120
+
121
+ - 通过`button-size`参数设置按钮大小
122
+ - 通过`icon-style`参数设置加减按钮图标的样式
123
+
124
+ ```vue
125
+ <uv-number-box button-size="36" color="#ffffff" bgColor="#2979ff" iconStyle="color: #fff"></uv-number-box>
126
+ ```
127
+
128
+ ### 自定义 slot
129
+
130
+ ```vue
131
+ <template>
132
+ <uv-number-box v-model="value">
133
+ <template v-slot:minus>
134
+ <view class="minus">
135
+ <uv-icon name="minus" size="12">
136
+ </uv-icon>
137
+ </view>
138
+ </template>
139
+ <template v-slot:input>
140
+ <text style="width: 50px;text-align: center;" class="input">
141
+ {{value}}
142
+ </text>
143
+ </template>
144
+ <template v-slot:plus>
145
+ <view class="plus">
146
+ <uv-icon name="plus" color="#FFFFFF" size="12">
147
+ </uv-icon>
148
+ </view>
149
+ </template>
150
+ </uv-number-box>
151
+ </template>
152
+ <script setup>
153
+ import { ref } from 'vue';
154
+
155
+ const value = ref(1);
156
+
157
+ </script>
158
+ <style lang="scss">
159
+ .minus {
160
+ width: 22px;
161
+ height: 22px;
162
+ border-width: 1px;
163
+ border-color: #E6E6E6;
164
+ border-style: solid;
165
+ border-top-left-radius: 100px;
166
+ border-top-right-radius: 100px;
167
+ border-bottom-left-radius: 100px;
168
+ border-bottom-right-radius: 100px;
169
+ /* #ifndef APP-NVUE */
170
+ display: flex;
171
+ /* #endif */
172
+ justify-content: center;
173
+ align-items: center;
174
+ }
175
+ .input {
176
+ padding: 0 10px;
177
+ }
178
+ .plus {
179
+ width: 22px;
180
+ height: 22px;
181
+ background-color: #FF0000;
182
+ border-radius: 50%;
183
+ /* #ifndef APP-NVUE */
184
+ display: flex;
185
+ /* #endif */
186
+ justify-content: center;
187
+ align-items: center;
188
+ }
189
+ </style>
190
+ ```
191
+
192
+ ### 完整示例
193
+
194
+ ::: tip 完整示例下载地址
195
+
196
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
197
+
198
+ :::
199
+
200
+ ### API
201
+ ---
202
+
203
+ ### NumberBox Props
204
+
205
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
206
+ | :- | :- | :- | :- | :- |
207
+ | value / v-model | 用于双向绑定的值,初始化时设置设为默认min值(最小值) | String &#124; Number | 1 | - |
208
+ | name | 步进器标识符,在change回调返回 | String &#124; Number | - | - |
209
+ | min | 用户可输入的最小值 | String &#124; Number | 1 | - |
210
+ | max | 用户可输入的最大值 | String &#124; Number | `Number.MAX_SAFE_INTEGER` | - |
211
+ | step | 步长,每次加或减的值, 支持小数值,如需小数 | String &#124; Number | 1 | - |
212
+ | integer | 是否只能输入正整数 | Boolean | false | true &#124; false |
213
+ | disabled | 是否禁用操作,包括输入框,加减按钮 | Boolean | false | true &#124; false |
214
+ | disabledInput | 是否禁止输入框 | Boolean | false | true &#124; false |
215
+ | asyncChange | 是否开启异步变更,开启后需要手动控制输入值 | Boolean | false | true &#124; false |
216
+ | inputWidth | 输入框宽度,单位px | String &#124; Number | 35 | - |
217
+ | showMinus | 是否显示减少按钮 | Boolean | true | true &#124; false |
218
+ | showPlus | 是否显示增加按钮 | Boolean | true | true &#124; false |
219
+ | decimalLength | 显示的小数位数 | String &#124; Number | - | - |
220
+ | longPress | 是否允许长按进行加减 | Boolean | true | true &#124; false |
221
+ | color | 输入框文字和加减按钮图标的颜色 | String | #323233 | - |
222
+ | buttonSize | 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致 | String &#124; Number | 30 | - |
223
+ | bgColor | 输入框和按钮的背景颜色 | String | #EBECEE | - |
224
+ | cursorSpacing | 指定光标于键盘的距离,避免键盘遮挡输入框,单位px | String &#124; Number | 100 | - |
225
+ | disablePlus | 是否禁用增加按钮 | Boolean | false | true &#124; false |
226
+ | disableMinus | 是否禁用减少按钮 | Boolean | false | true &#124; false |
227
+ | iconStyle | 加减按钮图标的样式 | String | - | - |
228
+
229
+
230
+ ### NumberBox Events
231
+
232
+ | 事件名 | 说明 | 回调参数 |
233
+ | :- | :- | :- |
234
+ | @focus | 输入框得到焦点触发(按钮可点击情况下),对象形式 | value:输入框当前值,name:步进器标识符 |
235
+ | @blur | 输入框失去焦点时触发,对象形式 | value:输入框当前值,name:步进器标识符 |
236
+ | @change| 输入框内容发生变化时触发,对象形式 | value:输入框当前值,name:步进器标识符 |
237
+ | @overlimit | 超过范围阈值时触发 | type:(`minus`已达最小值,`plus`已达最大值) |
238
+
239
+ ### NumberBox Slots
240
+
241
+ | 名称 | 说明 |
242
+ | :- | :- |
243
+ | minus | 减少按钮 |
244
+ | input | 输入框 |
245
+ | plus | 增加按钮 |
246
+
247
+ <style scoped>
248
+ h3[id=numberbox-events] + table thead tr th:nth-child(2){
249
+ width: 40%;
250
+ }
251
+ h3[id=numberbox-events] + table thead tr th:nth-child(3){
252
+ width: 40%;
253
+ }
254
+ h3[id=numberbox-slots] + table thead tr th:nth-child(2){
255
+ width: 70%;
256
+ }
257
+ </style>
@@ -0,0 +1,170 @@
1
+ ## Nvue特性相关
2
+
3
+ 前言:uv-ui在1.x版本,只有部分组件支持`nvue`,不推荐在`nvue`项目中使用,目前uv-ui研发组正在研发2.0版本,将会全面兼容`nvue`,我们在这里做一个专题,列出一些`nvue`上的坑,希望能帮助到您。
4
+
5
+
6
+ ### Text组件
7
+
8
+ - 我们在`vue`中,可以将文本相关的内容放到`view`或者`text`组件,这都是没问题的,但是在`nvue`中,需要动态响应(双向绑定)的内容,必须放在`text`标签,如果放在`view`可以正常显示,但是无法双向绑定。
9
+
10
+ - 在`nvue`中,文本的样式无法继承父元素的颜色(color),必须具体到给每一个`text`元素定义类名,在通过指定的类名给赋予颜色值,其他类似出现不能继承父组件的情况,也可参考此做法。
11
+
12
+ - 在`nvue`中,`text`组件不能换行写内容,否则会出现无法去除的周边空白内容(类似被加上了`padding`或者`margin`的效果),如下:
13
+
14
+ ```html
15
+ <!-- nvue中错误写法 -->
16
+ <text>
17
+ 桃花潭水深千尺
18
+ </text>
19
+
20
+ <!-- nvue中正确写法 -->
21
+ <text>不及汪伦送我情</text>
22
+ ```
23
+
24
+
25
+ ### 事件冒泡
26
+
27
+ `weex`事件冒泡相关文档 —— [事件冒泡](https://weex.apache.org/zh/docs/events/event-bubbling.html#%E9%98%BB%E6%AD%A2%E5%86%92%E6%B3%A1)
28
+
29
+ 在`weex`原文中,需要给给页面(组件)根元素设置`bubble="true"`才能产生事件冒泡机制,但是在`uni-app`的`nvue`中,已自动加上类似`bubble="true"`的操作,无需用户额外干预,自动就会获得事件冒泡的机制。另外,在nvue中,我们可以通过如下方式阻止事件冒泡:
30
+
31
+ ```html
32
+ <template>
33
+ <view @tap="parentClick">
34
+ <text @tap="childClick">
35
+ </view>
36
+ </template>
37
+
38
+ <script setup>
39
+ function childClick(e) {
40
+ console.log('内部被点击');
41
+ e.stopPropagation();
42
+ }
43
+
44
+ function parentClick() {
45
+ console.log('父元素将不会捕获冒泡事件');
46
+ }
47
+ </script>
48
+ ```
49
+
50
+
51
+ ### line-height
52
+
53
+ 在`nvue`中,`line-height`与字体大小`font-size`无关,如果赋予数值,单位默认为`px`,这意味着不可以如下使用:
54
+
55
+ ```css
56
+ .box {
57
+ /* vue正常,nvue中会导致行高只有1px */
58
+ line-height: 1;
59
+ }
60
+ ```
61
+
62
+ ### 样式穿透
63
+
64
+ 在`weex`(`nvue`)中有如此描述:[在 Weex 里, 每一个 Vue 组件的样式都是 scoped](https://weex.apache.org/zh/guide/use-vue-in-weex.html#%E5%B9%B3%E5%8F%B0%E7%9A%84%E5%B7%AE%E5%BC%82),这说明`vue`中的的`/deep/`和`::v-deep`在`nvue`中都是无效,修改子组件样式只能通过传参进行,而不能进行样式穿透。
65
+
66
+
67
+ ### 字体引入不能加引号
68
+
69
+ `nvue`下,`font-family`的字体引入,不能加引号,否则会导致字体图标无法显示,如下:
70
+
71
+ ```css
72
+ /* 错误写法 */
73
+ font-family: 'uicon-iconfont';
74
+
75
+ /* 正确写法 */
76
+ font-family:con-iconfont;
77
+ ```
78
+
79
+ ### Nvue不支持部分全局应用配置
80
+
81
+ 在 `nvue` 中,不建议依赖 `main.js` 中的全局混入或全局属性。如有需要,可以在每一个 `nvue` 文件中独立引入组合式函数:
82
+
83
+ ```js
84
+ // composables/useExample.js
85
+ export function useExample() {
86
+ function doSomething() {
87
+ // ...
88
+ }
89
+
90
+ return {
91
+ doSomething
92
+ };
93
+ }
94
+ ```
95
+
96
+ ```vue
97
+ <script setup>
98
+ import { useExample } from '@/composables/useExample.js';
99
+
100
+ const { doSomething } = useExample();
101
+ </script>
102
+ ```
103
+
104
+
105
+ ### Scss中的:export无效
106
+
107
+ 在`vue`中,我们可以通过`*.scss`中使用[:export](https://www.jianshu.com/p/069f4f79de16)进行变量导出,供`js`和`css`共同使用变量,但是`nvue`中不支持此写法,请勿使用。
108
+
109
+
110
+ ### transition属性不能简写
111
+
112
+ 在`vue`中,我们可以很方便的简写`transition`属性,但是`nvue`中,必须分开写才有效,如下:
113
+
114
+ - [weex文档关于transition的描述](https://weex.apache.org/zh/docs/styles/common-styles.html#transition)
115
+
116
+ ```css
117
+ /* 如下写法,vue有效,nvue无效 */
118
+ transition: opacity 0.3s ease-in;
119
+
120
+ /* nvue页面需要拆分成如下写法 */
121
+ transition-property: opacity;
122
+ transition-duration: 0.3s;
123
+ transition-timing-function: ease-in;
124
+ ```
125
+
126
+
127
+ ### box-shadow
128
+
129
+ 据关于[weex关于box-shadow文档](https://weex.apache.org/zh/docs/styles/common-styles.html#%E9%98%B4%E5%BD%B1-box-shadow)描述,`weex`不支持`android`上的`box-shadow`属性,但是经实测,在`nvue`(uni-app改良后台的`weex`)上`android`,是支持的`box-shadow`属性效果的。
130
+
131
+ 需要说明的是,在`IOS`上,目前(2020-10-30)不允许将`box-shadow`值设置为`none`,否则会出现锐利的高亮白色边框,由于`nvue`支持`rgba`透明度,我们可以通过如下方式实现类似`none`的效果:
132
+
133
+ ```css
134
+ .box {
135
+ box-shadow: 0 0 0 0 rgba(0, 0, 0, 0)
136
+ }
137
+ ```
138
+
139
+
140
+ ### border-radius
141
+
142
+ [在`weex`文档中有明确的说明](https://weex.apache.org/zh/docs/styles/common-styles.html#border-radius),`border-radius`支持简写形式,但是在`nvue`的`android`端,`border-radius`必须分开写才有效,如下:
143
+
144
+ ```css
145
+ /* nvue下,安卓不支持此写法 */
146
+ .box {
147
+ border-radius: 10px;
148
+ }
149
+
150
+ /* 必须如下写法才能兼容 */
151
+ .box {
152
+ border-bottom-left-radius: 10px;
153
+ border-bottom-right-radius: 10px;
154
+ border-top-left-radius: 10px;
155
+ border-top-right-radius: 10px;
156
+ }
157
+ ```
158
+
159
+
160
+ ### 关于<template\/> 和 <block\/>
161
+
162
+ 以下文字取自uni-app文档原文,[点此查看](https://uniapp.dcloud.io/frame?id=template-block):
163
+
164
+ ```
165
+ `<template/>` 和 `<block/>` 并不是一个组件,它们仅仅是一个包装元素,不会在页面中做任何渲染,只接受控制属性。
166
+ `<block/>` 在不同的平台表现存在一定差异,推荐统一使用 `<template/>`。
167
+ ```
168
+
169
+ 上面说,二者不会在页面做任何的渲染,但是在`nvue`中,`<block/>`确确实实被渲染成为一个`<block/>`元素,由于`nvue`默认`flex`布局,且为
170
+ `column`竖向布局,这可能会导致`<block/>`标签下存在多个其他元素时,这些元素会竖向排列,您不得不额外对`<block/>`元素设置样式,所以我们建议只要是`nvue`的场景,一律使用`<template/>`而不是`<block/>` 标签
@@ -0,0 +1,117 @@
1
+ ## Overlay 遮罩层 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsC/overlay/overlay"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-overlay**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-overlay)
10
+
11
+ :::
12
+
13
+ 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景,`uv-popup`、`uv-toast`、`uv-tooltip`等组件就是用了该组件
14
+
15
+ ### 平台兼容性
16
+
17
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
18
+ |:-:|:-:|:-:|:-:|:-:|:-:|
19
+ |√|√|√|√|√|√|
20
+
21
+ ### 基本使用
22
+
23
+ - 通过`show`参数配置是否显示遮罩
24
+ - 遮罩被点击时,会发送一个`click`事件,如不需要此事件,请设置`mask-click-able`参数为`false`
25
+
26
+ ```vue
27
+ <template>
28
+ <uv-overlay :show="show" @click="show = false"></uv-overlay>
29
+ </template>
30
+ <script setup>
31
+ import { ref } from 'vue';
32
+
33
+ const show = ref(true);
34
+
35
+ </script>
36
+ ```
37
+
38
+ ### 嵌入内容
39
+
40
+ 通过默认插槽可以在遮罩层上嵌入任意内容
41
+ 注意:如果不想让`slot`插槽内容的点击事件冒泡到遮罩,请给指定元素添加上`@tap.stop`
42
+
43
+ ```vue
44
+ <template>
45
+ <uv-overlay :show="show" @click="show = false">
46
+ <view class="warp">
47
+ <view class="rect" @tap.stop></view>
48
+ </view>
49
+ </uv-overlay>
50
+ </template>
51
+ <script setup>
52
+ import { ref } from 'vue';
53
+
54
+ const show = ref(true);
55
+
56
+ </script>
57
+ <style scoped>
58
+ .warp {
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ height: 100%;
63
+ }
64
+
65
+ .rect {
66
+ width: 120px;
67
+ height: 120px;
68
+ background-color: #fff;
69
+ }
70
+ </style>
71
+ ```
72
+
73
+ ### 遮罩样式
74
+
75
+ - 通过`duration`设置遮罩淡入淡出的时长,单位`ms`
76
+
77
+ ```vue
78
+ <uv-overlay :show="true" :duration="400" :z-index ="999" :opacity="0.3"></uv-overlay>
79
+ ```
80
+
81
+ ### 完整示例
82
+
83
+ ::: tip 完整示例下载地址
84
+
85
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
86
+
87
+ :::
88
+
89
+ ### API
90
+ ---
91
+
92
+ ### Overlay Props
93
+
94
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
95
+ | :- | :- | :- | :- | :- |
96
+ | show | 是否显示遮罩 | Boolean | false | true &#124; false |
97
+ | zIndex | `z-index`层级 | String &#124; Number | 10070 | - |
98
+ | duration | 动画时长,单位毫秒`ms` | String &#124; Number | 300 | - |
99
+ | opacity | 不透明度值,当做rgba的第四个参数 | String &#124; Number | 0.5 | - |
100
+
101
+ ### Overlay Events
102
+
103
+ | 事件名 | 说明 | 回调参数 |
104
+ | :- | :- | :- |
105
+ | @click | 点击遮罩发送此事件 | - |
106
+
107
+ ### Overlay Slots
108
+
109
+ | 名称 | 说明 |
110
+ | :- | :- |
111
+ | default | 默认插槽,用于在遮罩层上方嵌入内容 |
112
+
113
+ <style scoped>
114
+ h3[id=overlay-slots] + table thead tr th:nth-child(2){
115
+ width: 70%;
116
+ }
117
+ </style>