import React from 'react'; import "./style.css"; export default class Confirm extends React.Component{ constructor(){ super(); this.state={ msg:"", btns:[] } this.div=null; } setData(msg,btns,div){ this.div=div; this.setState({msg:msg,btns:btns}); } clickBtn(index){ if(this.state.btns[index].onPress){ this.state.btns[index].onPress(); } document.body.removeChild(this.div); } render(){ return(
{this.state.msg}
{ this.state.btns.length>0 && this.state.btns.map((item,index)=>{ return (
{item.text}
) }) }
) } }