# agileh-ui
**Repository Path**: zxy_cns/agileh-ui
## Basic Information
- **Project Name**: agileh-ui
- **Description**: agileh-ui 组件库
一个关于前端程序员进阶的组件库项目,只会用算什么?自己写才是真本事👏👏👏👏👏 大家共同努力呀
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 3
- **Forks**: 0
- **Created**: 2021-11-11
- **Last Updated**: 2023-03-17
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
`下载: git clone https://gitee.com/zxy_cns/agileh-ui.git`
`运行环境: node 14.*`
## Button
```jsx
const [count, setCount] = React.useState(0);
Clicked {count} times
{
setCount(count + 1);
}}
>
Button
;
```
```jsx
const kinds = ['primary', 'secondary', 'success', 'danger', 'default'];
const sorts = ['line', 'flat'];
sorts.map((sort) => {
return (
sort: {sort}
{kinds.map((kind) => (
{kind}
))}
);
});
```
```jsx
const sizes = ['s', 'm', 'l'];
sizes.map((size) => (
按钮
));
```
```jsx
不可点击
不可点击
```
```jsx
加载中
```
## CheckBox
```jsx
import React, { useState } from 'react';
import CheckBox from './index';
const [state, setstate] = useState([]);
const onChange = (a) => {
console.log(a);
};
哈哈哈
嘻嘻嘻
;
```
## CheckBoxGroup
```jsx
const onChange = (checkedValues) => {
console.log('checked = ', checkedValues);
};
const plainOptions = ['Apple', 'Pear', 'Orange'];
const options = [
{ label: '苹果', value: 'Apple' },
{ label: '梨', value: 'Pear' },
{ label: '橘子', value: 'Orange' },
];
const optionsWithDisabled = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Pear', value: 'Pear' },
{ label: '禁用', value: 'Orange', disabled: true },
];
结合CheckBoxGroup使用
------------
------------
;
```
## CreateTable
```jsx
import Row from './ItemRow';
import Col from './ItemCol';
姓名
王明
民族
汉
学号
1810170422
出生年月
1992年04月
性别
女
文化程度
大学专科
入学批次
18春
政治面貌
群众
联系电话
15295954951
{/* colSpan 向下合并几列 */}
身份证号
418749415113461956
通讯地址
河南省郑州市XXXXXX哈哈哈
报考志愿
专业名称
专业代码
工商管理
120201
学历层次
专科升本科
入学考试成绩
大学英语
大学英语
大学英语
140
130
270.0
;
```
## Form
```jsx
import { useRef } from 'react';
import Form from './index';
import Field from './Field';
import Button from '../Button';
import { isEmpty } from 'loadsh';
import Input from '../Input';
import IMG1 from '../Input/bz.png';
import IMG2 from '../Input/bql.png';
const formRef = useRef(null);
const rules = {
username: (val, data) => {
if (val && val.length >= 5) {
return true;
}
return '用户名必须在6-18位之间';
},
password: [{ validate: 'phone', message: '手机号错误' }],
};
const onSubmit = () => {
// 为空表示验证通过
console.log(formRef);
// console.log('store.validate() ==> ', store.validate());
formRef.current.Submit((d) => {
console.log(d);
});
};
const onReset = () => {
formRef.current.Reset();
};
;
```
## Icon
```jsx
icon 组件使用的react Icon 请参考: https://react-icons.github.io/react-icons/
```
## Input
```jsx
import Input from './index';
;
```
```jsx
import IMG2 from './bql.png';
import IMG3 from './bg.png';
import IMG4 from './jz.png';
import IMG1 from './bz.png';
;
```
```jsx
import Input from './index';
import IMG2 from './bql.png';
禁用
{
console.log('rers ===> ', ref);
}}
disabled
placeholder="请输入"
suffix={
}
/>
;
```
## xMessage
```jsx
import { useState } from 'react';
import Button from '../Button';
import xMessage from '.';
{
xMessage.pop({ type: 'success', content: 'success' });
}}
>
success
{
xMessage.pop({ type: 'info', content: 'info' });
}}
>
info
{
xMessage.pop({ type: 'error', content: 'error' });
}}
>
error
{
xMessage.pop({ type: 'warning', content: 'warning' });
}}
>
warning
;
```
## Modal
```jsx
import { useState } from 'react';
import Button from '../Button';
const [visible, setVisible] = useState(false);
{
setVisible(true);
}}
>
打开
setVisible(false)}
onCancel={() => setVisible(false)}
// footer={null}
>
12456
;
```
## Radio
```jsx
import React, { useState } from 'react';
import Radio from './index';
const [selectV, setSelectv] = useState(123);
单独使用
{
setSelectv(e);
}}
>
男
{
setSelectv(e);
}}
>
女
{
setSelectv(e);
}}
>
未知
;
```
```jsx
import RadioGroup from './RadioGroup';
const options = [
{ value: 123, label: 123 },
{ value: 456, label: 456 },
{ value: 789, label: 789, disabled: true },
];
结合RadioGroup使用
{
console.log('v ====> 选择了 ', v);
}}
button={true}
defaultValue={123}
/>
;
```
```jsx
import RadioGroup from './RadioGroup';
const options = [
{ value: 123, label: 123 },
{ value: 456, label: 456 },
];
{
console.log('v ====> 选择了 ', v);
}}
defaultValue={123}
/>
;
```
## Select
```jsx
import React from 'react';
import Select from './index';
import Option from './Option';
import IMG1 from '../Input/bg.png';
import IMG2 from '../Input/bz.png';
在特定盒子内
document.getElementById('area')}
style={{ width: '220px', marginTop: '30px' }}
>
} label="第一" value="1">
不在特定盒子内
} label="第一" value="1">
设置默认值
} label="第一" value="1">
;
```
## Table
```jsx
import Button from '../Button';
const dataSource = [
{ key: '1', name: '胡彦斌', age: 32, address: '高新区电子商务产业园' },
{ key: '2', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '2', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '3', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '4', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '5', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '6', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '7', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '8', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '9', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '10', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
];
const columns = [
{ title: '姓名', dataIndex: 'name', key: 'name' },
{ title: '年龄', dataIndex: 'age', key: 'age' },
{ title: '住址', dataIndex: 'address', key: 'address' },
{
title: '操作',
dataIndex: 'cz',
key: 'cz',
render: (r, x) => {
return (
{
console.log(r, x);
}}
>
编辑
);
},
},
];
;
```
## 固定表头和首列
```jsx
const dataSource = [
{ key: '1', name: '胡彦斌', age: 32, address: '高新区电子商务产业园' },
{ key: '2', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '2', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '3', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '4', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '5', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '6', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '7', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '8', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '9', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
{ key: '10', name: '胡彦祖', age: 42, address: '高新区电子商务产业园' },
];
const columns = [
{ title: '姓名', dataIndex: 'name', key: 'name' },
{ title: '年龄', dataIndex: 'age', key: 'age' },
{ title: '住址', dataIndex: 'address', key: 'address' },
];
;
```
## MaskLogin 全局弹窗
全局登录蒙版,不使用路由跳转登录,而是直接渲染到当前页面,登陆后执行指定的回调,使用方法为 API 式调用,类似 antd 的 model.confirm()
```jsx
import MaskLogin from './index';
import Button from '../Button';
const loginShow = () => {
MaskLogin({
// 打开登录弹窗钩子
open() {
console.log('打开弹窗回调 ===> ');
},
// 弹窗关闭后钩子
close() {
console.log('关闭弹窗回调 ===> ');
},
// 登录成功
success(uInfo) {
console.log('uInfo 登陆成功回调 ====> ', uInfo);
},
// 登录失败
fail(err) {
console.log('err ====> 登陆失败回调 ', err);
},
});
};
loginShow()} kind="success" sort="flat">
打开登录全局弹窗
;
```
## 组件库展示 GIF