2020-08-13 11:47:56 +08:00
|
|
|
# Toast
|
|
|
|
|
|
|
|
## Demos
|
|
|
|
|
|
|
|
### Types
|
|
|
|
|
2021-10-20 01:11:27 +08:00
|
|
|
`Toast` component has 4 contextual types, which are `success`, `info`, `warning` and `error`. Types are specified with the [`type`](#props-type) prop.
|
2020-08-13 11:47:56 +08:00
|
|
|
|
|
|
|
[[ demo src="/demo/toast/default.vue" ]]
|
|
|
|
|
|
|
|
### Imperative invocation
|
|
|
|
|
|
|
|
Use `veui/plugins/toast` to enable [`toast` plugin](../plugins/toast) and invoke the toast imperatively.
|
|
|
|
|
|
|
|
[[ demo src="/demo/toast/plugin.vue" ]]
|
|
|
|
|
|
|
|
## API
|
|
|
|
|
|
|
|
### Props
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| -- | -- | -- | -- |
|
2021-10-20 01:11:27 +08:00
|
|
|
| ``open`` | `boolean` | `false` | [^open] |
|
|
|
|
| ``type`` | `string` | `'success'` | [^type] |
|
|
|
|
| ``message`` | `string` | - | The toast message. |
|
|
|
|
| ``duration`` | `number` | `toast.duration` | Time (in milliseconds) to wait until the toast is automatically closed. |
|
2020-08-13 11:47:56 +08:00
|
|
|
|
|
|
|
^^^open
|
|
|
|
:::badges
|
|
|
|
`.sync`
|
|
|
|
:::
|
|
|
|
|
|
|
|
Whether the toast is displayed.
|
|
|
|
^^^
|
|
|
|
|
|
|
|
^^^type
|
|
|
|
The contextual type of the toast.
|
|
|
|
|
|
|
|
+++Enum values
|
|
|
|
| Value | Description |
|
|
|
|
| -- | -- |
|
|
|
|
| `info` | Information toast. |
|
|
|
|
| `success` | Succuess toast. |
|
|
|
|
| `warning` | Warning toast. |
|
|
|
|
| `error` | Error toast. |
|
|
|
|
+++
|
|
|
|
^^^
|
|
|
|
|
|
|
|
### Slots
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| -- | -- |
|
2021-10-20 01:11:27 +08:00
|
|
|
| ``default`` | The content of the toast. Displays the [`message`](#props-message) prop by default. |
|
2020-08-13 11:47:56 +08:00
|
|
|
|
|
|
|
### Events
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| -- | -- |
|
2021-10-20 01:11:27 +08:00
|
|
|
| ``close`` | Triggered when the toast is closed. |
|
2020-08-13 11:47:56 +08:00
|
|
|
|
2021-10-20 01:11:27 +08:00
|
|
|
### Configs
|
2020-08-13 11:47:56 +08:00
|
|
|
|
|
|
|
| Key | Type | Default | Description |
|
|
|
|
| -- | -- | -- | -- |
|
2021-10-20 01:11:27 +08:00
|
|
|
| ``toast.duration`` | `number` | `3000` | The duration of the toast in milliseconds. |
|
2020-08-13 11:47:56 +08:00
|
|
|
|
|
|
|
### Icons
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| -- | -- |
|
2021-10-20 01:11:27 +08:00
|
|
|
| ``info`` | Information toast. |
|
|
|
|
| ``success`` | Success toast. |
|
|
|
|
| ``warning`` | Warning toast. |
|
|
|
|
| ``error`` | Error toast. |
|