MCPcopy Create free account
hub / github.com/Lobos/react-ui / multOpen

Method multOpen

docs/src/js/pages/modal.jsx:16–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 }
15
16 multOpen () {
17 let index = this.state.index + 1,
18 width = Math.ceil((Math.random() + 1) * 400),
19 ps = [];
20
21 for (var i = 1; i <= index; i++) {
22 ps.push(<p key={i}>{`第 ${i} 层Modal`}</p>);
23 }
24
25 let options = {
26 header: `第 ${index} 层Modal`,
27 width: width,
28 content: (
29 <div>
30 {ps}
31 <a style={{marginRight: 20}} onClick={this.multOpen.bind(this)}>弹出新的Modal</a>
32 <a style={{marginRight: 20}} onClick={() => Modal.alert('alert')}>alert</a>
33 <a onClick={() => Modal.close()}>关闭</a>
34 </div>
35 ),
36 onClose: () => {
37 this.setState({ index: index - 1 });
38 },
39 buttons: {
40 '关闭': true
41 }
42 };
43 Modal.open(options);
44 this.setState({ index });
45 }
46
47 render () {
48 return (

Callers

nothing calls this directly

Calls 2

closeMethod · 0.80
openMethod · 0.80

Tested by

no test coverage detected