|
|
|
@ -23,22 +23,31 @@ export function SnackbarHOC(options = {}) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 全局的snackbar this.props.showSnackbar调用即可
|
|
|
|
|
showSnackbar(description, message = "提示",icon) {
|
|
|
|
|
// this.setState({
|
|
|
|
|
// snackbarOpen: true,
|
|
|
|
|
// snackbarText: text,
|
|
|
|
|
// snackbarVertical: vertical,
|
|
|
|
|
// snackbarHorizontal: horizontal,
|
|
|
|
|
// })
|
|
|
|
|
const data = {
|
|
|
|
|
message,
|
|
|
|
|
description
|
|
|
|
|
}
|
|
|
|
|
if (icon) {
|
|
|
|
|
data.icon = icon;
|
|
|
|
|
// showSnackbar(description, message = "提示",icon) {
|
|
|
|
|
// // this.setState({
|
|
|
|
|
// // snackbarOpen: true,
|
|
|
|
|
// // snackbarText: text,
|
|
|
|
|
// // snackbarVertical: vertical,
|
|
|
|
|
// // snackbarHorizontal: horizontal,
|
|
|
|
|
// // })
|
|
|
|
|
// const data = {
|
|
|
|
|
// message,
|
|
|
|
|
// description
|
|
|
|
|
// }
|
|
|
|
|
// if (icon) {
|
|
|
|
|
// data.icon = icon;
|
|
|
|
|
// }
|
|
|
|
|
// notification.open(data);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
showSnackbar(text, vertical, horizontal) {
|
|
|
|
|
this.setState({
|
|
|
|
|
snackbarOpen: true,
|
|
|
|
|
snackbarText: text,
|
|
|
|
|
snackbarVertical: vertical,
|
|
|
|
|
snackbarHorizontal: horizontal,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
notification.open(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical } = this.state;
|
|
|
|
|