Jelajahi Sumber

修改弹窗IE8不居中

zhangxc 6 tahun lalu
induk
melakukan
aae1d5e66e

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

@@ -68,6 +68,7 @@ const defaultProps = {
     cancelBorderColor: '#414141',
     cancelBg: '#fff',
     width: '300px',
+    height: '200px',
 };
 
 class ConfirmModal extends Component {
@@ -123,10 +124,12 @@ class ConfirmModal extends Component {
             closable, 
             noFooter
         } = this.props;
+        const marginLeft = -parseInt(width)/2
+        const marginTop = -parseInt(height)/2
         return (
             <NewPortal visible={visible}>
                 <div className={styles['modal-wrapper']} id='confirm'>
-                    <div className={styles[['modal']]} style = {{width: width, height:height}}>
+                    <div className={styles[['modal']]} style = {{width: width, marginLeft:marginLeft, height:height, marginTop:marginTop}}>
                         <div className={styles['modal-title']} style={{background: titleBg}}>{title ? title : ''} {closable ? <img onClick={this.closeModal} className={styles['modal-close']} src = {close}/> : false}</div>
                         <div className={styles['modal-content']}>{children}</div>
                         {noFooter ? '' : <div className={styles['modal-operator']+' clearfix'}>

+ 0 - 1
src/common/components/ConfirmModal/index.less

@@ -2,7 +2,6 @@
     position: fixed;
     top: 50%;
     left: 50%;
-    transform: translate(-50%,-50%);
     margin: auto;
     border-radius: 5px;
     background: #fff;