mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
commit
4b3b1505dc
@ -18,6 +18,7 @@ export interface AlertProps extends ThemeProps, LocaleProps {
|
||||
title?: string;
|
||||
confirmBtnLevel?: string;
|
||||
alertBtnLevel?: string;
|
||||
isolate?: boolean;
|
||||
}
|
||||
|
||||
export interface AlertState {
|
||||
@ -54,6 +55,7 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
||||
content: '',
|
||||
confirm: false
|
||||
};
|
||||
originInstance: Alert | null;
|
||||
constructor(props: AlertProps) {
|
||||
super(props);
|
||||
|
||||
@ -64,8 +66,11 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
||||
this.handleFormSubmit = this.handleFormSubmit.bind(this);
|
||||
this.scopeRef = this.scopeRef.bind(this);
|
||||
|
||||
if (!props.isolate) {
|
||||
this.originInstance = Alert.instance;
|
||||
Alert.instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
confirmText: 'confirm',
|
||||
@ -86,7 +91,10 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
Alert.instance = null;
|
||||
if (Alert.instance === this) {
|
||||
Alert.instance = this.originInstance || null;
|
||||
this.originInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
schemaSope: any;
|
||||
|
Loading…
Reference in New Issue
Block a user