Commit cdc14756 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Notification: add closeAll

parent 2fa6935e
...@@ -279,8 +279,7 @@ Import `Message`: ...@@ -279,8 +279,7 @@ Import `Message`:
import { Message } from 'element-ui'; 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)`. 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.
You can call `Message.closeAll()` to manually close all the instances.
### Options ### Options
| Attribute | Description | Type | Accepted Values | Default | | Attribute | Description | Type | Accepted Values | Default |
......
...@@ -397,7 +397,7 @@ Import `Notification`: ...@@ -397,7 +397,7 @@ Import `Notification`:
import { Notification } from 'element-ui'; 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 ### Options
| Attribute | Description | Type | Accepted Values | Default | | Attribute | Description | Type | Accepted Values | Default |
......
...@@ -279,8 +279,7 @@ Import `Message`: ...@@ -279,8 +279,7 @@ Import `Message`:
import { Message } from 'element-ui'; 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)`. 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.
Puede llamar al metodo `Message.closeAll()` para cerrar manualmente todas las instancias.
### Options ### Options
| Atributo | Descripcion | Tipo | Valores permitidos | Por defecto | | Atributo | Descripcion | Tipo | Valores permitidos | Por defecto |
......
...@@ -404,7 +404,7 @@ Importar `Notification`: ...@@ -404,7 +404,7 @@ Importar `Notification`:
import { Notification } from 'element-ui'; 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 ### Opciones
| Atributo | Descripción | Tipo | Valores aceptados | Por defecto | | Atributo | Descripción | Tipo | Valores aceptados | Por defecto |
......
...@@ -279,8 +279,7 @@ Element 为 Vue.prototype 添加了全局方法 $message。因此在 vue instanc ...@@ -279,8 +279,7 @@ Element 为 Vue.prototype 添加了全局方法 $message。因此在 vue instanc
import { Message } from 'element-ui'; import { Message } from 'element-ui';
``` ```
此时调用方法为 `Message(options)`。我们也为每个 type 定义了各自的方法,如 `Message.success(options)` 此时调用方法为 `Message(options)`。我们也为每个 type 定义了各自的方法,如 `Message.success(options)`。并且可以调用 `Message.closeAll()` 手动关闭所有实例。
并且可以调用 `Message.closeAll()` 手动关闭所有实例。
### Options ### Options
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
......
...@@ -398,7 +398,7 @@ Element 为 `Vue.prototype` 添加了全局方法 `$notify`。因此在 vue inst ...@@ -398,7 +398,7 @@ Element 为 `Vue.prototype` 添加了全局方法 `$notify`。因此在 vue inst
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
``` ```
此时调用方法为 `Notification(options)`。我们也为每个 type 定义了各自的方法,如 `Notification.success(options)` 此时调用方法为 `Notification(options)`。我们也为每个 type 定义了各自的方法,如 `Notification.success(options)`并且可以调用 `Notification.closeAll()` 手动关闭所有实例。
### Options ### Options
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
......
...@@ -84,4 +84,10 @@ Notification.close = function(id, userOnClose) { ...@@ -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; export default Notification;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment