Notification: add closeAll

pull/9522/head
Leopoldthecoder 2018-01-29 12:32:46 +08:00 committed by 杨奕
parent 2fa6935e58
commit cdc14756ae
7 changed files with 12 additions and 9 deletions

View File

@ -279,8 +279,7 @@ Import `Message`:
import { Message } from 'element-ui';
```
In this case you should call `Message(options)`. We have also registered methods for different types, e.g. `Message.success(options)`.
You can call `Message.closeAll()` to manually close all the instances.
In this case you should call `Message(options)`. We have also registered methods for different types, e.g. `Message.success(options)`. You can call `Message.closeAll()` to manually close all the instances.
### Options
| Attribute | Description | Type | Accepted Values | Default |

View File

@ -397,7 +397,7 @@ Import `Notification`:
import { Notification } from 'element-ui';
```
In this case you should call `Notification(options)`. We have also registered methods for different types, e.g. `Notification.success(options)`.
In this case you should call `Notification(options)`. We have also registered methods for different types, e.g. `Notification.success(options)`. You can call `Notification.closeAll()` to manually close all the instances.
### Options
| Attribute | Description | Type | Accepted Values | Default |

View File

@ -279,8 +279,7 @@ Import `Message`:
import { Message } from 'element-ui';
```
En este caso deberia llamar al metodo `Message(options)`. Tambien se han registrado metodos para los diferentes tipos, e.g. `Message.success(options)`.
Puede llamar al metodo `Message.closeAll()` para cerrar manualmente todas las instancias.
En este caso deberia llamar al metodo `Message(options)`. Tambien se han registrado metodos para los diferentes tipos, e.g. `Message.success(options)`. Puede llamar al metodo `Message.closeAll()` para cerrar manualmente todas las instancias.
### Options
| Atributo | Descripcion | Tipo | Valores permitidos | Por defecto |

View File

@ -404,7 +404,7 @@ Importar `Notification`:
import { Notification } from 'element-ui';
```
En este caso, debe llamar a `Notification(options)`. También se han registrado métodos para diferentes tipos, e.j. `Notification.success(options)`.
En este caso, debe llamar a `Notification(options)`. También se han registrado métodos para diferentes tipos, e.j. `Notification.success(options)`. Puede llamar al metodo `Notification.closeAll()` para cerrar manualmente todas las instancias.
### Opciones
| Atributo | Descripción | Tipo | Valores aceptados | Por defecto |

View File

@ -279,8 +279,7 @@ Element 为 Vue.prototype 添加了全局方法 $message。因此在 vue instanc
import { Message } from 'element-ui';
```
此时调用方法为 `Message(options)`。我们也为每个 type 定义了各自的方法,如 `Message.success(options)`
并且可以调用 `Message.closeAll()` 手动关闭所有实例。
此时调用方法为 `Message(options)`。我们也为每个 type 定义了各自的方法,如 `Message.success(options)`。并且可以调用 `Message.closeAll()` 手动关闭所有实例。
### Options
| 参数 | 说明 | 类型 | 可选值 | 默认值 |

View File

@ -398,7 +398,7 @@ Element 为 `Vue.prototype` 添加了全局方法 `$notify`。因此在 vue inst
import { Notification } from 'element-ui';
```
此时调用方法为 `Notification(options)`。我们也为每个 type 定义了各自的方法,如 `Notification.success(options)`
此时调用方法为 `Notification(options)`。我们也为每个 type 定义了各自的方法,如 `Notification.success(options)`并且可以调用 `Notification.closeAll()` 手动关闭所有实例。
### Options
| 参数 | 说明 | 类型 | 可选值 | 默认值 |

View File

@ -84,4 +84,10 @@ Notification.close = function(id, userOnClose) {
}
};
Notification.closeAll = function() {
for (let i = instances.length - 1; i >= 0; i--) {
instances[i].close();
}
};
export default Notification;