Browse Source

修改loading弹窗位置

zhangxc 5 years ago
parent
commit
ba47f32916

+ 4 - 1
src/common/components/Loading/index.jsx

@@ -10,6 +10,7 @@ import React, {Component} from 'react';
 import style from './index.less';
 // import icon from './img/loading.gif';
 import icon from '@common/images/loading.gif';
+import ReactDom from 'react-dom';
 
 /*const propTypes = {
     text: PropTypes.string,
@@ -37,7 +38,8 @@ const defaultProps = {
 class Loading extends React.Component{
     render(){
         const {text,show} = this.props;
-        return (
+        const domNode = document.getElementById('root');
+        return ReactDom.createPortal(<React.Fragment>
             <div className={style['loading']} style={{display: show ? 'block' : 'none'}}>
                 {/*{this.props.shadeIsShow?<div className={style['cover']}/>:null}*/}
                 <div className={style['cover']}/>
@@ -46,6 +48,7 @@ class Loading extends React.Component{
                     <p>{text}</p>
                 </div>
             </div>
+        </React.Fragment>,domNode
         )
     }
 }

+ 2 - 1
src/common/components/Loading/index.less

@@ -1,10 +1,11 @@
+@import "~@less/variables.less";
 .loading{
+  .maskZIndex;
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
-  z-index: 999;
   .cover{
     width: 100%;
     height: 100%;