2019-10-16 23:28:36 +08:00
|
|
|
# Notification
|
2020-01-30 20:56:17 +08:00
|
|
|
If something is to be telled to you.
|
|
|
|
|
|
|
|
UI has designed it long long ago. However, you know, it is always with low piority so I can make a lot of useless animations on it.
|
|
|
|
## Demos
|
2019-10-16 23:28:36 +08:00
|
|
|
```demo
|
|
|
|
basic
|
2019-12-07 23:13:52 +08:00
|
|
|
type
|
2020-01-30 20:56:17 +08:00
|
|
|
change-content
|
2019-12-08 20:47:14 +08:00
|
|
|
scrollable
|
|
|
|
closable
|
|
|
|
duration
|
2020-01-30 20:56:17 +08:00
|
|
|
```
|
|
|
|
## API
|
|
|
|
### $NNotification API
|
|
|
|
|Property|Type|Description|
|
|
|
|
|-|-|-|
|
|
|
|
|open|`(option: NotificationOption, type: string): NotificationEnvironment`||
|
|
|
|
|success|`(option: NofiticationOption): NotificationEnvironment`||
|
|
|
|
|info|`(option: NofiticationOption): NotificationEnvironment`||
|
|
|
|
|warning|`(option: NofiticationOption): NotificationEnvironment`||
|
|
|
|
|error|`(option: NofiticationOption): NotificationEnvironment`||
|
|
|
|
|scrollable|`boolean`|Default is set to `true`|
|
|
|
|
|
|
|
|
### NotificationOption API
|
|
|
|
|Property|Type|Default|Description|
|
|
|
|
|-|-|-|-|
|
|
|
|
|avatar|`string \| function`|`null`|Can be render function|
|
|
|
|
|title|`string \| function`|`null`|Can be render function|
|
|
|
|
|description|`string \| function`|`null`|Can be render function|
|
|
|
|
|content|`string \| function`|`null`|Can be render function|
|
|
|
|
|meta|`string \| function`|`null`|Can be render function|
|
|
|
|
|action|`string \| function`|`null`|Can be render function|
|
|
|
|
|closable|`boolean`|`true`||
|
|
|
|
|onClose|`(next: function) => any`|`next => next()`|Only if next is called notification will close|
|
2020-01-30 23:23:51 +08:00
|
|
|
|onAfterHide|`function`|`null`||
|
|
|
|
|onAfterShow|`function`|`null`||
|
2020-01-30 20:56:17 +08:00
|
|
|
|duration|`number`|`null`|If not set, it won't automatically close|
|
|
|
|
|
|
|
|
### NotificationEnvironment API
|
2020-01-30 23:23:51 +08:00
|
|
|
#### NotificationEnvironment Properties
|
|
|
|
Properties of Instance of NofiticationEnvironment can be dynamically set.
|
2020-01-30 20:56:17 +08:00
|
|
|
|
|
|
|
|Property|Type|Description|
|
|
|
|
|-|-|-|
|
|
|
|
|avatar|`string \| function`|Can be render function|
|
|
|
|
|title|`string \| function`|Can be render function|
|
|
|
|
|description|`string \| function`|Can be render function|
|
|
|
|
|content|`string \| function`|Can be render function|
|
|
|
|
|meta|`string \| function`|Can be render function|
|
|
|
|
|action|`string \| function`|Can be render function|
|
|
|
|
|closable|`boolean`||
|
2020-01-30 23:23:51 +08:00
|
|
|
|onClose|`(next: function) => any`|Close mark is clicked. Only if next is called notification will close|
|
|
|
|
|onHide|`function`||
|
|
|
|
|onAfterHide|`function`||
|
|
|
|
|onAfterShow|`function`||
|
|
|
|
|
|
|
|
#### NotificationEnvironment Methods
|
|
|
|
|Method|Type|Description|
|
|
|
|
|-|-|-|
|
|
|
|
|hide|`()`||
|