css - 顶部的 ReactJS Bootstrap 模态

标签 css reactjs bootstrap-modal

我有一个带有一些表格的模态,单击一行将打开另一个我希望位于顶部的模态,但“模态主体”似乎显示了第一个模态的一些信息!

任何帮助都会很棒!谢谢!

enter image description here

我可以从下面的模式中滚动表格

Modal.js

import React from 'react';
import PropTypes from 'prop-types';

class Modal extends React.Component {
  render() {
    // Render nothing if the "show" prop is false
    if(!this.props.show) {
      return null;
    }

      // The gray background
    const backdropStyle = {
      position: 'fixed',
      top: 0,
      bottom: 0,
      left: 0,
      right: 0,
      backgroundColor: 'rgba(0,0,0,0.3)',
      padding: 50
    };

    // The modal "window"
    const modalStyle = {
      backgroundColor: '#fff',
      borderRadius: 5,
      maxWidth: 1500,
      minHeight: 800,
      margin: '0 auto',
      padding: 10
    };    

    return (

    <div className="backdrop" style={backdropStyle}>
     <div className="modal-content" style={modalStyle}>

        <div className="modal-content">
          <div className="modal-header">
            <h4 className="modal-title">{this.props.titulo}</h4>
            <button onClick={this.props.onClose} type="button" className="close">&times;</button>
          </div>
          <div className="modal-body">
            {this.props.children}
          </div>
          <div className="modal-footer">
            <button type="button" className="btn btn-default" onClick={this.props.onClose}>Close</button>
          </div>
        </div>
     </div>
    </div>

    );
  }
}

Modal.propTypes = {
  onClose: PropTypes.func.isRequired,
  show: PropTypes.bool,
  children: PropTypes.node
};

export default Modal;

最佳答案

我是如何解决的

我制作了另一个 Modal (Modal2.js) .z3 用于顶部模态,.z1 用于底部模态!

.z1 {
  z-index: 1000;
}

.z3 {
  z-index: 1200;
}

关于css - 顶部的 ReactJS Bootstrap 模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50678802/

相关文章:

css - 在 Bootstrap 上使用模态时滚动条消失

html - 在 Flash 页面中编辑分辨率

html - 使图像响应?

javascript - 给自定义 React 组件一个 className 不起作用

css - 如何使Material UI v1.0 Dialog背景透明?

asp.net - Bootstrap 表页脚未显示在底部

javascript - 响应式移动菜单的问题

jquery - 无法从网页写入 XML

reactjs - React 事件处理程序中 this 的值

javascript - Angular JS 中的错误在浏览器中显示预览为 {{dish.comment}}?