1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* 徐立
* 2019年9月16日
* Modal定制样式
*/
import React, { Component } from 'react'
import { Modal, Button } from 'antd';
import styles from './index.less'
export default class WebModal extends Component {
constructor(props) {
super(props);
this.state={
top: 0,
}
}
/**
* 钟是志
* 2020年4月22日 17:07:53
* 修改Iframe打开弹窗的时候 弹窗定位错误的bug
* */
componentDidMount(){
setTimeout(()=>{
let dom = document.getElementById('detailInfoDiv');
if(dom && dom.offsetHeight){
let height = dom.offsetHeight;
if(height > 700){
this.setState({
top: height - 700,
})
}
// console.log(height, 'Iframe页面的高度');
}
}, 1500);
}
render() {
let { visible, handleCancel, title, width } =this.props;
const { top } = this.state;
const style = {
borderRadius:4,
};
if(top){
style.top = top;
}
return (
<div>
<Modal
closable={false}
visible={visible}
footer={null}
destroyOnClose={true}
width={!!width ? width : 800}
handleCancel={handleCancel}
style={style}
>
<div className={styles.content_div}>
<div className={styles.title}>{title}<Button className={styles.button} onClick={handleCancel}>X</Button></div>
{this.props.children}
</div>
</Modal>
</div>
)
}
}