This commit is contained in:
2022-05-11 10:51:18 +08:00
commit f3496ff9d0
18 changed files with 369 additions and 0 deletions

110
src/API/介绍.md Normal file
View File

@@ -0,0 +1,110 @@
# 介绍
工具库中的所有方法,均挂载在$u对象下
### 去除空格
该方法可以去除空格,分别可以去除所有空格,两端空格,左边空格,右边空格,默认为去除两端空格
```js
str <String> 字符串
pos <String> 去除那些位置的空格可选为both-默认值去除两端空格left-去除左边空格right-去除右边空格all-去除包括中间和两端的所有空格
```
```js
this.$u.trim();
```
### 取一个区间数
取一个区间数
```js
/**
* @description 取一个区间数
* @param {Number} min 最小值
* @param {Number} max 最大值
*/
this.$u.random(min, max);
```
### range
如果value小于min取min如果value大于max取max
```js
/**
* @description 如果value小于min取min如果value大于max取max
* @param {number} min
* @param {number} max
* @param {number} value
*/
this.$u.range();
```
### 路由
> 路由转驼峰
```js
// 使用
this.$u.path2camelcase('/u/note/123');
// uNote123
```
### 时间处理
> 格式化时间
```js
// 使用
this.$u.formatDate(1652233263000);
// 2022-05-11 09:41:03
```
> 获取月份天数
```js
getMonthDays(myMonth = new Date().getMonth()):number
```
```js
// 使用
this.$u.getMonthDays();
// 31
```
> 获取月开始日期
```js
getMonthStartDay(dateObj, pattern)
- dateObj 时间
- pattern 格式化
```
```js
this.$u.getMonthStartDay();
// 2022-05-01
```
> 获得月结束日期
```js
getMonthEndDate(dateObj, pattern)
- dateObj 时间
- pattern 格式化
```
```js
this.$u.getMonthEndDate();
// 2022-05-31
```

22
src/API/网络请求.md Normal file
View File

@@ -0,0 +1,22 @@
# 网络请求
开源请求库axios
http://www.axios-js.com/
### 配置文件
`/src/boot/axios.js`
### 使用
```js
this.$http.post('/mock', data).then(res=>{
// 成功
}).catch(e=>{
// 失败
}).finally(e=>{
})
```

21
src/API/颜色转换.md Normal file
View File

@@ -0,0 +1,21 @@
# 颜色转换
### RGB转十六进制Hex
将一个RGB颜色值转换成一个Hex的十六进制颜色值
```js
this.$u.rgbToHex("rgb(13, 145, 20)");
// #0d9114
```
### Hex转RGB
将一个Hex的十六进制颜色值转换成一个RGB颜色值
```js
this.$u.hexToRgb("#0d9114");
// rgb(13,145,20)
```

0
src/index.ts Normal file
View File

23
src/组件/CommonTitle.md Normal file
View File

@@ -0,0 +1,23 @@
# CommonTitle
公共title样式
### 使用
```js
import CommonTitle from '@/pages/components/CommonTitle.vue';
```
```js
<common-title color="green" title="数据填写" icon="icon-a-tubiaosysbeifen7" :needIcon="false">
```
### 属性
| 属性 | 说明 | 类型 | 默认值 |
| -------- | ---- | ---- |-----|
| title | | | 数据填写 |
| color | | | blue |
| icon | | | '' |
| needIcon | | | true |

21
src/组件/弹窗.md Normal file
View File

@@ -0,0 +1,21 @@
# 弹窗
![](https://alicdn.taoya.art/img/202205110848983.png)
```js
this.$confirm({
title: '提示',
message: '您确定要退出登录吗?',
btn: {
okText: '确定',
cancelText: '取消'
}
})
.then(() => {
})
.catch(() => {
console.log('no')
})
```

9
src/组件/表格.md Normal file
View File

@@ -0,0 +1,9 @@
# 表格
```js
import CommonTable from '@/components/Table'
```