标签:dialog run onclick open tee dom dia ops alert
import test from '../components/test'
const info = () => {
test.info('This is a normal message');
};
render(){
retrun <button onClick={info}>click me</button>
}
import React, { Component } from "react";
import ReactDOM from "react-dom";
import { Dialog, DialogTitle } from "@material-ui/core";
const Alert = (props) => (
<Dialog open={true} fullWidth>
<DialogTitle>{props.msg}</DialogTitle>
</Dialog>
);
class Test extends Component {
static info(msg) {
const div = document.createElement("div");
document.body.append(div);
ReactDOM.render(<Alert msg={msg}/>, div);
}
}
export default Test;
标签:dialog run onclick open tee dom dia ops alert
原文地址:https://www.cnblogs.com/ajanuw/p/9880233.html