@gmcb/uv-ui 0.2.27 → 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.
- 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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 aniu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,164 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
<span> </span><img alt="logo" src="https://www.uvui.cn/common/logo.png" width="120" height="120">
|
|
3
|
-
</p>
|
|
4
|
-
<h3 align="center">uv-ui</h3>
|
|
5
|
-
<h3 align="center">兼容vue3+2多平台快速开发的UI框架</h3>
|
|
1
|
+
# @gmcb/uv-ui
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
[](https://gitee.com/climblee/uv-ui)
|
|
9
|
-
[](https://github.com/climblee/uv-ui)
|
|
10
|
-
[](https://github.com/climblee/uv-ui/issues)
|
|
11
|
-
[](https://www.uvui.cn)
|
|
12
|
-
[](https://www.uvui.cn/components/changelog.html)
|
|
13
|
-
[](https://en.wikipedia.org/wiki/MIT_License)
|
|
3
|
+
基于 uv-ui 的 uni-app 多端 UI 组件包,包含组件、主题样式、工具函数和 `$uv` 全局能力。
|
|
14
4
|
|
|
15
|
-
##
|
|
5
|
+
## 安装
|
|
16
6
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## uvui特点
|
|
21
|
-
|
|
22
|
-
1. **uv-ui的前世今生**,`uv-ui` 是基于 `uview2.x` 版本改造而来。重命名也是为了避开发布冲突和很多组件 `u-`在 `nvue` 中不能使用的情况,所以这才诞生了`uv-ui`。感谢 `uview-ui` 作者的开源奉献,再次为开源点赞。 同时 `uv-ui` 也是无条件开源。
|
|
23
|
-
|
|
24
|
-
2. **全端兼容**,`uv-ui`支持vue3、vue2、app-vue、app-nvue、h5、小程序等。`uv-ui`的组件都是多端自适应的,底层会抹平很多小程序平台的差异或bug。
|
|
25
|
-
|
|
26
|
-
3. **扩展配置**,`uv-ui`内置的方法默认不再挂载到`uni`对象之上,也就意味着默认情况下不能在项目中直接使用`uni.$uv.xxx`使用内置方法。但是可以通过扩展可以解决,通过如下方式进行配置即可,使用方式请参考[扩展配置](https://www.uvui.cn/components/setting.html)。其中包括[ JS工具库](https://www.uvui.cn/components/setting.html#%E6%89%A9%E5%B1%95%E9%85%8D%E7%BD%AE-js%E5%B7%A5%E5%85%B7%E5%BA%93)、[ 自定义主题](https://www.uvui.cn/components/setting.html#%E6%89%A9%E5%B1%95%E9%85%8D%E7%BD%AE-%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%BB%E9%A2%98)、[ 基础样式](https://www.uvui.cn/components/setting.html#%E6%89%A9%E5%B1%95%E9%85%8D%E7%BD%AE-%E5%9F%BA%E7%A1%80%E6%A0%B7%E5%BC%8F)、[ setconfig](https://www.uvui.cn/components/setting.html#%E6%89%A9%E5%B1%95%E9%85%8D%E7%BD%AE-setconfig)等。
|
|
27
|
-
|
|
28
|
-
## 预览
|
|
29
|
-
|
|
30
|
-
通过微信(APP下载不支持微信扫码)或浏览器扫码查看演示效果。
|
|
31
|
-
|
|
32
|
-
<img src="https://mp-31ed6237-7b7b-4597-8448-a53d6d6031cf.cdn.bspapp.com/uvui/download-wx.png" width="200" /> <img src="https://mp-31ed6237-7b7b-4597-8448-a53d6d6031cf.cdn.bspapp.com/uvui/download-app.png" width="200" /> <img src="https://mp-31ed6237-7b7b-4597-8448-a53d6d6031cf.cdn.bspapp.com/uvui/download-h5.png" width="200" />
|
|
33
|
-
|
|
34
|
-
## 链接
|
|
35
|
-
|
|
36
|
-
- [官方文档](https://www.uvui.cn)
|
|
37
|
-
- [演示地址](https://h5.uvui.cn)
|
|
38
|
-
- [更新日志](https://www.uvui.cn/components/changelog.html)
|
|
39
|
-
- [关于我们](https://www.uvui.cn/cooperation/about.html)
|
|
40
|
-
- <a href="#list">组件列表</a>
|
|
7
|
+
```bash
|
|
8
|
+
npm i @gmcb/uv-ui
|
|
9
|
+
```
|
|
41
10
|
|
|
42
|
-
##
|
|
11
|
+
## 引入
|
|
43
12
|
|
|
44
|
-
|
|
13
|
+
在 uni-app 项目入口中注册:
|
|
45
14
|
|
|
46
|
-
|
|
15
|
+
```ts
|
|
16
|
+
import { createSSRApp } from 'vue';
|
|
17
|
+
import uvUI from '@gmcb/uv-ui';
|
|
18
|
+
import App from './App.vue';
|
|
47
19
|
|
|
48
|
-
|
|
20
|
+
export function createApp() {
|
|
21
|
+
const app = createSSRApp(App);
|
|
22
|
+
app.use(uvUI);
|
|
23
|
+
return {
|
|
24
|
+
app,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
```
|
|
49
28
|
|
|
50
|
-
|
|
29
|
+
引入基础样式:
|
|
51
30
|
|
|
52
|
-
|
|
31
|
+
```scss
|
|
32
|
+
@import '@gmcb/uv-ui/index.scss';
|
|
33
|
+
@import '@gmcb/uv-ui/theme.scss';
|
|
34
|
+
```
|
|
53
35
|
|
|
54
|
-
|
|
36
|
+
## easycom 配置
|
|
55
37
|
|
|
56
|
-
|
|
38
|
+
建议在 `pages.json` 中配置 easycom,组件即可在页面中直接使用:
|
|
57
39
|
|
|
58
|
-
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"easycom": {
|
|
43
|
+
"autoscan": true,
|
|
44
|
+
"custom": {
|
|
45
|
+
"^uv-(.*)": "@gmcb/uv-ui/components/uv-$1/uv-$1.vue"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
59
50
|
|
|
60
|
-
|
|
51
|
+
使用示例:
|
|
61
52
|
|
|
62
53
|
```html
|
|
63
54
|
<template>
|
|
64
|
-
|
|
55
|
+
<uv-button type="primary">提交</uv-button>
|
|
56
|
+
<uv-icon name="search" size="24"></uv-icon>
|
|
65
57
|
</template>
|
|
66
58
|
```
|
|
67
59
|
|
|
68
|
-
##
|
|
69
|
-
|
|
70
|
-
`uv-ui` 内置了强大的工具函数、请求封装等,可以根据自身需求进行扩展配置,详情请查看[扩展配置](https://www.uvui.cn/components/setting.html)。
|
|
60
|
+
## 全局能力
|
|
71
61
|
|
|
72
|
-
|
|
62
|
+
注册后会向 `uni.$uv` 注入常用工具:
|
|
73
63
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
| 能力 | 说明 |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `uni.$uv.http` | 基于 `luch-request` 的请求实例。 |
|
|
67
|
+
| `uni.$uv.route` | 路由跳转封装。 |
|
|
68
|
+
| `uni.$uv.config` | uv-ui 配置。 |
|
|
69
|
+
| `uni.$uv.debounce` / `uni.$uv.throttle` | 防抖与节流。 |
|
|
70
|
+
| `uni.$uv.test` | 常用校验方法。 |
|
|
71
|
+
| `uni.$uv.colorGradient`、`hexToRgb`、`rgbToHex` | 颜色工具。 |
|
|
72
|
+
| `uni.$uv.platform` | 平台判断工具。 |
|
|
73
|
+
| `uni.$uv.compress` | 压缩工具。 |
|
|
74
|
+
|
|
75
|
+
Vue 3 项目中也可通过组件实例访问 `$uv`。
|
|
76
|
+
|
|
77
|
+
## 组件目录
|
|
78
|
+
|
|
79
|
+
组件位于 `components/uv-*`,常用组件包括:
|
|
80
|
+
|
|
81
|
+
- `uv-button`
|
|
82
|
+
- `uv-icon`
|
|
83
|
+
- `uv-form`
|
|
84
|
+
- `uv-input`
|
|
85
|
+
- `uv-popup`
|
|
86
|
+
- `uv-modal`
|
|
87
|
+
- `uv-tabs`
|
|
88
|
+
- `uv-navbar`
|
|
89
|
+
- `uv-upload`
|
|
90
|
+
- `uv-calendar`
|
|
91
|
+
- `uv-datetime-picker`
|
|
92
|
+
- `uv-swiper`
|
|
93
|
+
- `uv-list`
|
|
94
|
+
- `uv-cell`
|
|
95
|
+
- `uv-toast`
|
|
96
|
+
|
|
97
|
+
更多组件可查看 `components` 目录或 uv-ui 官方文档。
|
|
98
|
+
|
|
99
|
+
## 参考链接
|
|
100
|
+
|
|
101
|
+
- [本包文档入口](./docs/index.md)
|
|
102
|
+
- [uv-ui 官方文档](https://www.uvui.cn)
|
|
103
|
+
- [uv-ui 演示地址](https://h5.uvui.cn)
|
|
104
|
+
- [uv-ui 更新日志](https://www.uvui.cn/components/changelog.html)
|
|
105
|
+
|
|
106
|
+
## 本地文档
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pnpm -C packages/uv-ui run docs:dev
|
|
110
|
+
pnpm -C packages/uv-ui run docs:build
|
|
111
|
+
pnpm -C packages/uv-ui run docs:preview
|
|
112
|
+
```
|
|
77
113
|
|
|
78
|
-
|
|
114
|
+
## 注意事项
|
|
79
115
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
| uv-calendars | [新版日历(推荐)](https://www.uvui.cn/components/calendars.html) |
|
|
84
|
-
| uv-drop-down | [下拉筛选](https://www.uvui.cn/components/dropDown.html) |
|
|
85
|
-
| uv-scroll-list | [横向滚动列表](https://www.uvui.cn/components/scrollList.html) |
|
|
86
|
-
| uv-vtabs | [垂直选项卡](https://www.uvui.cn/components/vtabs.html) |
|
|
87
|
-
| uv-pick-color | [颜色选择器](https://www.uvui.cn/components/pickColor.html) |
|
|
88
|
-
| uv-qrcode | [二维码](https://www.uvui.cn/components/qrcode.html) |
|
|
89
|
-
| uv-waterfall | [瀑布流](https://www.uvui.cn/components/waterfall.html) |
|
|
90
|
-
| uv-row | [Layout 布局](https://www.uvui.cn/components/layout.html) |
|
|
91
|
-
| uv-icon | [图标](https://www.uvui.cn/components/icon.html) |
|
|
92
|
-
| uv-button | [按钮](https://www.uvui.cn/components/button.html) |
|
|
93
|
-
| uv-text | [文本](https://www.uvui.cn/components/text.html) |
|
|
94
|
-
| uv-link | [超链接](https://www.uvui.cn/components/link.html) |
|
|
95
|
-
| uv-image | [图片](https://www.uvui.cn/components/image.html) |
|
|
96
|
-
| uv-transition | [动画](https://www.uvui.cn/components/transition.html) |
|
|
97
|
-
| uv-form | [表单](https://www.uvui.cn/components/form.html) |
|
|
98
|
-
| uv-input | [增强输入框](https://www.uvui.cn/components/input.html) |
|
|
99
|
-
| uv-textarea | [增强文本域](https://www.uvui.cn/components/textarea.html) |
|
|
100
|
-
| uv-checkbox | [复选框](https://www.uvui.cn/components/checkbox.html) |
|
|
101
|
-
| uv-radio | [单选框](https://www.uvui.cn/components/radio.html) |
|
|
102
|
-
| uv-switch | [开关选择器](https://www.uvui.cn/components/switch.html) |
|
|
103
|
-
| uv-calendar | [日历](https://www.uvui.cn/components/calendar.html) |
|
|
104
|
-
| uv-picker | [选择器](https://www.uvui.cn/components/picker.html) |
|
|
105
|
-
| uv-datetime-picker | [时间选择器](https://www.uvui.cn/components/datetimePicker.html) |
|
|
106
|
-
| uv-code | [验证码倒计时](https://www.uvui.cn/components/code.html) |
|
|
107
|
-
| uv-keyboard | [键盘](https://www.uvui.cn/components/keyboard.html) |
|
|
108
|
-
| uv-rate | [评分](https://www.uvui.cn/components/rate.html) |
|
|
109
|
-
| uv-search | [多功能搜索框](https://www.uvui.cn/components/search.html) |
|
|
110
|
-
| uv-number-box | [步进器](https://www.uvui.cn/components/numberBox.html) |
|
|
111
|
-
| uv-upload | [上传](https://www.uvui.cn/components/upload.html) |
|
|
112
|
-
| uv-slider | [滑动选择器](https://www.uvui.cn/components/slider.html) |
|
|
113
|
-
| uv-list | [列表](https://www.uvui.cn/components/list.html) |
|
|
114
|
-
| uv-index-list | [索引列表](https://www.uvui.cn/components/indexList.html) |
|
|
115
|
-
| uv-tags | [标签](https://www.uvui.cn/components/tag.html) |
|
|
116
|
-
| uv-line-progress | [线形进度条](https://www.uvui.cn/components/lineProgress.html) |
|
|
117
|
-
| uv-badge | [徽标数](https://www.uvui.cn/components/badge.html) |
|
|
118
|
-
| uv-count-down | [倒计时](https://www.uvui.cn/components/countDown.html) |
|
|
119
|
-
| uv-count-to | [数字滚动](https://www.uvui.cn/components/countTo.html) |
|
|
120
|
-
| uv-avatar | [头像](https://www.uvui.cn/components/avatar.html) |
|
|
121
|
-
| uv-skeleton | [骨架屏](https://www.uvui.cn/components/skeleton.html) |
|
|
122
|
-
| uv-loading-icon | [加载动画](https://www.uvui.cn/components/loadingIcon.html) |
|
|
123
|
-
| uv-loading-page | [加载页](https://www.uvui.cn/components/loadingPage.html) |
|
|
124
|
-
| uv-load-more | [加载更多](https://www.uvui.cn/components/loadMore.html) |
|
|
125
|
-
| uv-empty | [内容为空](https://www.uvui.cn/components/empty.html) |
|
|
126
|
-
| uv-tooltip | [长按提示](https://www.uvui.cn/components/tooltip.html) |
|
|
127
|
-
| uv-alert | [警告提示](https://www.uvui.cn/components/alert.html) |
|
|
128
|
-
| uv-toast | [消息提示](https://www.uvui.cn/components/toast.html) |
|
|
129
|
-
| uv-notice-bar | [滚动通知](https://www.uvui.cn/components/noticeBar.html) |
|
|
130
|
-
| uv-notify | [消息提示](https://www.uvui.cn/components/notify.html) |
|
|
131
|
-
| uv-no-network | [无网络提示](https://www.uvui.cn/components/noNetwork.html) |
|
|
132
|
-
| uv-popup | [弹出层](https://www.uvui.cn/components/popup.html) |
|
|
133
|
-
| uv-modal | [模态框](https://www.uvui.cn/components/modal.html) |
|
|
134
|
-
| uv-cell | [单元格](https://www.uvui.cn/components/cell.html) |
|
|
135
|
-
| uv-swipe-action | [滑动单元格](https://www.uvui.cn/components/swipeAction.html) |
|
|
136
|
-
| uv-swiper | [轮播图](https://www.uvui.cn/components/swiper.html) |
|
|
137
|
-
| uv-collapse | [折叠面板](https://www.uvui.cn/components/collapse.html) |
|
|
138
|
-
| uv-grid | [宫格布局](https://www.uvui.cn/components/grid.html) |
|
|
139
|
-
| uv-album | [相册](https://www.uvui.cn/components/album.html) |
|
|
140
|
-
| uv-tabbar | [底部导航栏](https://www.uvui.cn/components/tabbar.html) |
|
|
141
|
-
| uv-back-top | [返回顶部](https://www.uvui.cn/components/backTop.html) |
|
|
142
|
-
| uv-navbar | [自定义导航栏](https://www.uvui.cn/components/navbar.html) |
|
|
143
|
-
| uv-action-sheet | [底部操作菜单](https://www.uvui.cn/components/actionSheet.html) |
|
|
144
|
-
| uv-tabs | [标签选项卡](https://www.uvui.cn/components/tabs.html) |
|
|
145
|
-
| uv-steps | [步骤条](https://www.uvui.cn/components/steps.html) |
|
|
146
|
-
| uv-subsection | [分段器](https://www.uvui.cn/components/subsection.html) |
|
|
147
|
-
| uv-sticky | [吸顶](https://www.uvui.cn/components/sticky.html) |
|
|
148
|
-
| uv-parse | [富文本解析器](https://www.uvui.cn/components/parse.html) |
|
|
149
|
-
| uv-overlay | [遮罩层](https://www.uvui.cn/components/overlay.html) |
|
|
150
|
-
| uv-code-input | [验证码输入](https://www.uvui.cn/components/codeInput.html) |
|
|
151
|
-
| uv-read-more | [展开阅读更多](https://www.uvui.cn/components/readMore.html) |
|
|
152
|
-
| uv-line | [线条](https://www.uvui.cn/components/line.html) |
|
|
153
|
-
| uv-gap | [间隔槽](https://www.uvui.cn/components/gap.html) |
|
|
154
|
-
| uv-divider | [分割线](https://www.uvui.cn/components/divider.html) |
|
|
155
|
-
|
|
156
|
-
## 版权信息
|
|
157
|
-
uv-ui遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uv-ui应用到您的产品中。
|
|
158
|
-
|
|
159
|
-
## 作者想说
|
|
160
|
-
- 开源真的不易,不图大家的钱财,所以希望大家多多鼓励支持,希望不要恶意评论,有问题加群快速解决。
|
|
161
|
-
- 遇到BUG,是一件很正常的事情,是程序肯定就有BUG,所以希望大家能以理解的心态去提出BUG,然后作者才有动力去努力修复。
|
|
162
|
-
- 最后觉得好用的小伙伴,不要吝啬你的双手,给个好评就是给我们最大的鼓励。
|
|
163
|
-
|
|
164
|
-
# 恶评者手下留情,有事加QQ群解决:549833913
|
|
116
|
+
- 本包面向 uni-app 多端项目,组件依赖 uni-app 运行环境。
|
|
117
|
+
- 小程序端如需分享 mixin,可在注册时传入对应选项,具体行为以 `index.js` 为准。
|
|
118
|
+
- 修改组件或主题后,请在示例项目中至少验证 H5 和目标小程序/App 平台。
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
## color 颜色值
|
|
2
|
+
|
|
3
|
+
此功能为uv-ui内部通过js提供的一些颜色值,可以用于通过js修改元素字体,背景颜色等一些场景,常用于uv-ui的各个组件中。
|
|
4
|
+
这些颜色值,挂载在`$uv`对象下的`color`数组中,关于这些颜色值的具体描述,详见[Color 色彩](/components/color.html)
|
|
5
|
+
使用方法:如使用`primary`颜色值,方法为:`$uv.color['primary']`
|
|
6
|
+
|
|
7
|
+
**说明**:这些通过JS调用的颜色值,也是能通过CSS调用的,二者等价。详见[Color 色彩](/components/color.html)
|
|
8
|
+
|
|
9
|
+
### 主题颜色
|
|
10
|
+
|
|
11
|
+
该主题颜色值,一共有5个,分别是`primary`、`error`、`success`、`info`、`warning`
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<script setup>
|
|
15
|
+
import { onLoad } from '@dcloudio/uni-app';
|
|
16
|
+
|
|
17
|
+
onLoad(() => {
|
|
18
|
+
console.log(uni.$uv.color['error']);
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### 文字颜色
|
|
25
|
+
|
|
26
|
+
uv-ui一共提供了四个颜色值,具体请见组件部分[Color色彩](/components/color.html)
|
|
27
|
+
分别有:`mainColor`、`contentColor`、`tipsColor`、`lightColor`、`borderColor`(边框颜色值)
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script setup>
|
|
31
|
+
import { onLoad } from '@dcloudio/uni-app';
|
|
32
|
+
|
|
33
|
+
onLoad(() => {
|
|
34
|
+
console.log(uni.$uv.color['contentColor']);
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### 背景颜色
|
|
41
|
+
|
|
42
|
+
uv-ui提供了一个浅灰的背景颜色值,该值为`#f3f4f6`
|
|
43
|
+
|
|
44
|
+
```vue
|
|
45
|
+
<script setup>
|
|
46
|
+
import { onLoad } from '@dcloudio/uni-app';
|
|
47
|
+
|
|
48
|
+
onLoad(() => {
|
|
49
|
+
console.log(uni.$uv.color['bgColor']);
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
本页记录 `@gmcb/uv-ui` 的主要运行时入口。组件文档请查看 [组件](../components/index.md),工具函数请查看 [工具](/api/utils/index.md)。
|
|
4
|
+
|
|
5
|
+
## 默认导出
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import uvUI from '@gmcb/uv-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
默认导出是 Vue 插件:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
app.use(uvUI);
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
安装后会注册全局 mixin,并向 `uni.$uv` 注入工具、配置、请求实例和路由方法。
|
|
18
|
+
|
|
19
|
+
## uni.$uv
|
|
20
|
+
|
|
21
|
+
| 能力 | 说明 | 文档 |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| `uni.$uv.http` | 基于 `luch-request` 的请求实例。 | [HTTP 请求](/api/request/http.md) |
|
|
24
|
+
| `uni.$uv.route` | 路由跳转封装。 | [路由](/api/utils/route.md) |
|
|
25
|
+
| `uni.$uv.config` | 内置配置对象。 | [扩展配置](../components/setting.md) |
|
|
26
|
+
| `uni.$uv.debounce` / `uni.$uv.throttle` | 防抖与节流。 | [防抖节流](/api/utils/debounce.md) |
|
|
27
|
+
| `uni.$uv.test` | 常用校验规则。 | [规则校验](/api/utils/test.md) |
|
|
28
|
+
| `uni.$uv.timeFormat` / `uni.$uv.timeFrom` | 时间格式化。 | [时间](/api/utils/time.md) |
|
|
29
|
+
| `uni.$uv.queryParams` | 对象转 URL 参数。 | [参数](/api/utils/queryParams.md) |
|
|
30
|
+
| `uni.$uv.colorGradient` / `hexToRgb` / `rgbToHex` | 颜色工具。 | [颜色](/api/utils/colorSwitch.md) |
|
|
31
|
+
| `uni.$uv.platform` | 平台判断。 | [快速使用](/api/utils/fastUse.md) |
|
|
32
|
+
|
|
33
|
+
## 深度引用
|
|
34
|
+
|
|
35
|
+
工具函数可以从包内 `libs` 路径按需引用:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { trim, random } from '@gmcb/uv-ui/libs/function/test.js';
|
|
39
|
+
import { timeFormat, queryParams } from '@gmcb/uv-ui/libs/function/index.js';
|
|
40
|
+
import route from '@gmcb/uv-ui/libs/utils/route.js';
|
|
41
|
+
import Request from '@gmcb/uv-ui/libs/luch-request/index.js';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
深度引用路径依赖当前包结构,升级前应确认目标文件仍存在。
|
|
45
|
+
|
|
46
|
+
## 样式入口
|
|
47
|
+
|
|
48
|
+
```scss
|
|
49
|
+
@import '@gmcb/uv-ui/theme.scss';
|
|
50
|
+
@import '@gmcb/uv-ui/index.scss';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 组件入口
|
|
54
|
+
|
|
55
|
+
推荐通过 easycom 使用组件:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"easycom": {
|
|
60
|
+
"autoscan": true,
|
|
61
|
+
"custom": {
|
|
62
|
+
"^uv-(.*)": "@gmcb/uv-ui/components/uv-$1/uv-$1.vue"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
确需手动引入时,按组件发布路径引用:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import UvButton from '@gmcb/uv-ui/components/uv-button/uv-button.vue';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 注意
|
|
75
|
+
|
|
76
|
+
- 当前文档统一使用 `utils` 作为工具分类,历史 `js` 路径不再保留。
|
|
77
|
+
- 文档中的历史接入方式不作为本包推荐路径;当前统一使用 `@gmcb/uv-ui`。
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
## mpShare 小程序分享
|
|
2
|
+
|
|
3
|
+
`mpShare` 是对小程序 `onShareAppMessage`、`onShareTimeline` 生命周期的封装。开启后,uv-ui 会通过 mixin 给页面注入默认分享逻辑;如果页面需要自定义分享内容,也可以在页面中使用 uni-app 的组合式生命周期覆盖。
|
|
4
|
+
|
|
5
|
+
### 开启分享
|
|
6
|
+
|
|
7
|
+
在 `main.js` 注册插件时传入 `mpShare: true`:
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import App from './App';
|
|
11
|
+
import { createSSRApp } from 'vue';
|
|
12
|
+
import uvUI from '@gmcb/uv-ui';
|
|
13
|
+
|
|
14
|
+
export function createApp() {
|
|
15
|
+
const app = createSSRApp(App);
|
|
16
|
+
app.use(uvUI, { mpShare: true });
|
|
17
|
+
return { app };
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 全局分享配置
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
uni.$uv.mpShare = {
|
|
25
|
+
title: '小程序名称',
|
|
26
|
+
path: '',
|
|
27
|
+
imageUrl: ''
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
页面中可在 `onReady` 后修改当前分享信息:
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<script setup>
|
|
35
|
+
import { onReady } from '@dcloudio/uni-app';
|
|
36
|
+
|
|
37
|
+
onReady(() => {
|
|
38
|
+
uni.$uv.mpShare.title = '对酒当歌,人生几何';
|
|
39
|
+
uni.$uv.mpShare.path = '/pages/index/index';
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 重写 onShareAppMessage
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<script setup>
|
|
49
|
+
import { onShareAppMessage } from '@dcloudio/uni-app';
|
|
50
|
+
|
|
51
|
+
onShareAppMessage(res => {
|
|
52
|
+
if (res.from === 'button') {
|
|
53
|
+
console.log(res.target);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
title: '自定义分享标题',
|
|
58
|
+
path: '/pages/test/test?id=123'
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
</script>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 分享到朋友圈
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<script setup>
|
|
69
|
+
import { onShareTimeline } from '@dcloudio/uni-app';
|
|
70
|
+
|
|
71
|
+
onShareTimeline(() => {
|
|
72
|
+
return {
|
|
73
|
+
title: '自定义朋友圈标题',
|
|
74
|
+
query: 'id=123',
|
|
75
|
+
imageUrl: ''
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
</script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 取消分享
|
|
83
|
+
|
|
84
|
+
单个页面可在生命周期中关闭:
|
|
85
|
+
|
|
86
|
+
```vue
|
|
87
|
+
<script setup>
|
|
88
|
+
import { onLoad } from '@dcloudio/uni-app';
|
|
89
|
+
|
|
90
|
+
onLoad(() => {
|
|
91
|
+
uni.$uv.mpShare = false;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
</script>
|
|
95
|
+
```
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
## API集中管理
|
|
2
|
+
|
|
3
|
+
这里说的集中管理,是指把各个请求,统一放到一个文件中进行管理,这样的好处是不用每次调用`uni.$uv.get`时都需要传入`url`参数,一些固定的
|
|
4
|
+
请求参数也可以不用显式的传入,如下为配置后的使用示例:
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
uni.$uv.api.getSearch().then(res => {
|
|
8
|
+
console.log(res);
|
|
9
|
+
})
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### 前言
|
|
13
|
+
|
|
14
|
+
在进行这个配置之前,建议先配置请求的拦截器,本示例和和拦截器是一脉相承的,请移步:[Http拦截器](/api/request/http.html)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### 准备工作
|
|
18
|
+
|
|
19
|
+
在根目录新建`/common/http.api.js`,如已有`common`目录,创建`http.api.js`即可。
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### 说明
|
|
23
|
+
|
|
24
|
+
本文件的内部大体结构,和请求拦截器的内部结构基本一致。Vue 3 项目中建议导出普通初始化函数,在 `main.js` 的 `createApp` 中接收 `app` 后完成挂载,
|
|
25
|
+
对各个参数的处理,在请求拦截器部分有关于内部各个参数的详细介绍,详见:[Http拦截器](/api/request/http.html)
|
|
26
|
+
|
|
27
|
+
以下为`/common/http.api.js`的内部内容,说明都在注释中,请举一反三,灵活配置即可:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
// /common/http.api.js
|
|
31
|
+
|
|
32
|
+
// 如果没有通过拦截器配置域名的话,可以在这里写上完整的URL(加上域名部分)
|
|
33
|
+
let hotSearchUrl = '/ebapi/store_api/hot_search';
|
|
34
|
+
let indexUrl = '/ebapi/public_api/index';
|
|
35
|
+
|
|
36
|
+
// 此处 app 就是 createSSRApp(App) 创建出的应用实例,可以通过 app.config.globalProperties 挂载全局能力。
|
|
37
|
+
// https://www.uvui.cn/api/request/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
|
|
38
|
+
export function setupHttpApi(app) {
|
|
39
|
+
// 此处没有使用传入的params参数
|
|
40
|
+
const getSearch = (params = {}) => uni.$uv.http.get(hotSearchUrl, {
|
|
41
|
+
id: 2
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// 此处使用了传入的params参数,一切自定义即可
|
|
45
|
+
const getInfo = (params = {}) => uni.$uv.http.post(indexUrl, params);
|
|
46
|
+
|
|
47
|
+
// 将各个定义的接口名称统一放进 uni.$uv.api 下,页面中可直接通过 uni.$uv.api 调用
|
|
48
|
+
uni.$uv.api = { getSearch, getInfo };
|
|
49
|
+
app.config.globalProperties.$api = uni.$uv.api;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 引入
|
|
54
|
+
|
|
55
|
+
我们上面是创建和配置了`http.api.js`,接下来需要在`main.js`中进行挂载,如果您配置了拦截器,这部分的引入代码,需要写在拦截器引入的后面:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import App from './App'
|
|
59
|
+
import { createSSRApp } from 'vue'
|
|
60
|
+
import uvUI from '@gmcb/uv-ui'
|
|
61
|
+
import { setupHttpInterceptor } from '@/common/http.interceptor.js'
|
|
62
|
+
import { setupHttpApi } from '@/common/http.api.js'
|
|
63
|
+
|
|
64
|
+
export function createApp() {
|
|
65
|
+
const app = createSSRApp(App)
|
|
66
|
+
app.use(uvUI)
|
|
67
|
+
setupHttpInterceptor(app)
|
|
68
|
+
setupHttpApi(app)
|
|
69
|
+
return { app }
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### 使用
|
|
75
|
+
|
|
76
|
+
经过以上配置后,我们可以在各个页面的js中方便的调用各个接口,如下示例:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
// 调用getSearch接口
|
|
80
|
+
uni.$uv.api.getSearch().then(res => {
|
|
81
|
+
console.log(res);
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// 调用getInfo接口
|
|
85
|
+
uni.$uv.api.getInfo({id: 3}).then(res => {
|
|
86
|
+
console.log(res);
|
|
87
|
+
})
|
|
88
|
+
```
|