图片加载,创建事件监听

     <img
          src={`https://zos.alipayobjects.com/rmsportal/${val}.png`}
          alt=""
          style={{ width: '100%', verticalAlign: 'top' }}
          onLoad={() => {
          // fire window resize event to change height
           window.dispatchEvent(new Event('resize'));
           this.setState({ imgHeight: 'auto' });
      }}
     />        

  

posted @ 2019-02-13 11:18  winyh  阅读(371)  评论(0编辑  收藏  举报