UNPKG

@ccs-design/rc-pro

Version:

ccs design basic react component

41 lines (37 loc) 1.13 kB
import "antd/es/spin/style"; import _Spin from "antd/es/spin"; import { LoadingOutlined } from '@ant-design/icons'; import { useTimeout } from 'ahooks'; import React, { useRef } from 'react'; import './index.less'; var LoadingSpin = function LoadingSpin(_ref) { var maxTime = _ref.maxTime; var ref = useRef(null); useTimeout(function () { var _ref$current; var styles = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.style; if (styles) styles.display = 'none'; }, maxTime); return /*#__PURE__*/React.createElement("div", { className: "ccs-spin", ref: ref }, /*#__PURE__*/React.createElement(_Spin, { indicator: /*#__PURE__*/React.createElement(LoadingOutlined, { style: { fontSize: 30 }, spin: true }) })); }; /** * 全屏遮罩loading */ export default (function (_ref2) { var loading = _ref2.loading, _ref2$maxTime = _ref2.maxTime, maxTime = _ref2$maxTime === void 0 ? 6000 : _ref2$maxTime; return loading ? /*#__PURE__*/React.createElement(LoadingSpin, { maxTime: maxTime }) : null; });