text: /* 按需加载高阶组件 */
  import React from 'react';
  import P from 'prop-types';
  
  class Bundle extends React.Component {
      constructor(props) {
          super(props);
          this.state = {
              mod: null
          };
      }
  
      UNSAFE_componentWillMount() {
          this.load(this.props);
      }
  
      UNSAFE_componentWillReceiveProps(nextProps) {
          if (nextProps.load !== this.props.load) {
              this.load(nextProps);
          }
      }
  
      load(props) {
          this.setState({
              mod: null
          });
          props.load((mod) => {
              this.setState({
                  mod: mod.default ? mod.default : mod
              });
          });
      }
  
      render() {
          return this.state.mod ? this.props.children(this.state.mod) : null;
      }
  }
  
  Bundle.propTypes = {
      load: P.any,
      children: P.any,
  };
  
  export default Bundle;