src/utils/asyncIconComponent.jsx
@@ -1,5 +1,5 @@ import React, {Component} from 'react' import { Icon } from 'antd' import { LoadingOutlined } from '@ant-design/icons' /** * @description 异步加载模块 @@ -21,10 +21,16 @@ this.setState({component}) } componentWillUnmount () { this.setState = () => { return } } render() { const C = this.state.component return C ? <C {...this.props} /> : <Icon type="loading" /> return C ? <C {...this.props} /> : <LoadingOutlined /> } } }