美文网首页
Dialog - Material-UI

Dialog - Material-UI

作者: YI_YI_ | 来源:发表于2018-04-24 18:01 被阅读0次

    1、

    import React from 'react';
    import Dialog from 'material-ui/Dialog';
    import FlatButton from 'material-ui/FlatButton';
    import RaisedButton from 'material-ui/RaisedButton';
    
    /**
     * Alerts are urgent interruptions, requiring acknowledgement, that inform the user about a situation.
     */
    export default class DialogExampleAlert extends React.Component {
      state = {
        open: false,
      };
    
      handleOpen = () => {
        this.setState({open: true});
      };
    
      handleClose = () => {
        this.setState({open: false});
      };
    
      render() {
        const actions = [
          <FlatButton
            label="Cancel"
            primary={true}
            onClick={this.handleClose}
          />,
          <FlatButton
            label="Discard"
            primary={true}
            onClick={this.handleClose}
          />,
        ];
    
        return (
          <div>
            <RaisedButton label="Alert" onClick={this.handleOpen} />
            <Dialog
              actions={actions}
              modal={false}
              open={this.state.open}
              onRequestClose={this.handleClose}
            >
              Discard draft?
            </Dialog>
          </div>
        );
      }
    }
    

    相关文章

      网友评论

          本文标题:Dialog - Material-UI

          本文链接:https://www.haomeiwen.com/subject/mrhjlftx.html