
React组件封装 + Tools
项目组件及其他相关
寒枫落林
From Zero To Hero.
展开
-
useChart
图表小组件原创 2022-07-19 18:13:23 · 264 阅读 · 0 评论 -
列表状态“颜色提示”组件
contant.tstype List<T> = Array<{ code: T; label: string;}>;const parseListToMap = <T>(list: List<keyof T>): Record<keyof T, string> => { const result: Record<keyof T, string> = Object.create(null);...原创 2022-07-08 19:33:44 · 323 阅读 · 0 评论 -
状态提示小组件
效果:types.tsexport interface RecordType { id: string; errMsg: string;}export interface StatusParams { desc: string; className: string;}export interface DescType { name: string; label: string;}Table.tsimport {DescT.原创 2022-07-08 19:36:12 · 281 阅读 · 0 评论 -
溢出文本+tooltip
/** * @file 溢出文本+tooltip */import {Tooltip} from 'antd';import {TooltipProps} from 'antd/lib/tooltip';import {FC, useCallback, useState} from 'react';import {useElementResize} from '@huse/element-size';interface IEllipsisTextProps { placement.原创 2022-07-08 19:37:30 · 199 阅读 · 0 评论 -
ErrorBoundary.tsx
/** * @file error boundary */import {Button, Result} from 'antd';import React, {Component} from 'react';import {Link} from 'react-router-dom';export default class ErrorBoundary extends Component<any, {hasError: boolean}> { constructor(pro.原创 2022-07-15 11:46:54 · 104 阅读 · 0 评论 -
NoData 组件
index.tsximport React from 'react';import nodataUrl from '@/assets/images/noData.svg';import './index.less';interface NoDataProps { text?: string; callback?: () => void; btnText?: string; style?: React.CSSProperties; classNam原创 2022-07-08 19:38:19 · 481 阅读 · 0 评论 -
Loading
index.tsx/** * @file Loading */import React from 'react';import {Spin} from 'antd';import './index.less';interface LoadingProps { style?: React.CSSProperties; className?: string;}const LoadingCom: React.FC<LoadingProps> = ({styl原创 2022-07-15 11:47:21 · 177 阅读 · 0 评论 -
封装上传按钮
import React, {useEffect, useState} from 'react';import {Button, message, Space, Upload} from 'antd';import {DraggerProps} from 'antd/lib/upload';import {UploadOutlined} from '@ant-design/icons';import {getToken} from '@/utils';import {getUUID} from..原创 2022-07-15 11:48:35 · 131 阅读 · 0 评论 -
穿梭框封装组件
效果一效果二封装的组件/* eslint-disable max-statements *//* eslint-disable react-hooks/exhaustive-deps *//** * @file 自定义画像 */import React, {Key, useEffect, useMemo, useRef, useState} from 'react';import {Button, Checkbox, Form, Input, message, Modal,原创 2022-07-08 19:39:57 · 694 阅读 · 0 评论 -
封装分页pagination组件
/** * @file pagination */import {Button, Input, Pagination, PaginationProps, Select} from 'antd';import React, {ChangeEvent, FC, useCallback, useEffect, useState} from 'react';import './index.less';function countMaxPage(total: number, pageSize: nu.原创 2022-07-15 11:49:23 · 475 阅读 · 0 评论 -
图表(Chart)封装
/* eslint-disable react-hooks/exhaustive-deps *//* eslint-disable no-underscore-dangle */import React from 'react';import * as echarts from 'echarts';import {Modal} from 'antd';/** * 参数列表 * key: string; 唯一值 * option: object | null; 图表数据 * style:.原创 2022-07-15 11:49:49 · 348 阅读 · 0 评论 -
过滤(FilterMultiple)封装组件
效果:使用:import type {ColumnsType, TablePaginationConfig} from 'antd/lib/table';// ,01:时间,02:数值-整数,03:数值-小数,04:枚举,05:文本const LABEL_TYPE: Record<string, string> = { '01': '时间', '02': '数值-整数', '03': '数值-小数', '04': '枚举', '05'.原创 2022-07-15 11:50:39 · 818 阅读 · 0 评论 -
api(样板)文件
/* eslint-disable @typescript-eslint/restrict-plus-operands *//* eslint-disable no-loop-func *//** * @file api */import axios, {AxiosRequestConfig} from 'axios';import {message} from 'antd';import {getToken} from '@/utils';import {getUUID} from '@.原创 2022-07-08 19:37:01 · 203 阅读 · 0 评论 -
输入框封装
index.tsx/** * @file 带字数指示的input */import {Input} from 'antd';import type {InputProps, TextAreaProps} from 'antd/lib/input';import {FC} from 'react';import './index.less';interface ILimitInputProps extends InputProps { maxLength: number;}原创 2022-07-08 19:39:14 · 259 阅读 · 0 评论 -
文件上传组件(FileUpload)
index1.tsximport React, {useEffect, useState} from 'react';import {Button, message, Space, Upload} from 'antd';import {DraggerProps} from 'antd/lib/upload';import {UploadOutlined} from '@ant-design/icons';import {getToken} from '@/utils';import {g原创 2022-07-15 11:48:00 · 793 阅读 · 0 评论