-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0f7074
commit 4f75b0a
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# In-app Notifications | ||
|
||
In Vue Storefront we're providing Notifications system based on composable `useUiNotification`. | ||
|
||
Shows notifications after some actions being performed in the shop. There are three types of notifications: danger, success and info. | ||
|
||
There is a dedicated interface for `useUiNotification`: | ||
|
||
```ts | ||
interface UseUiNotification { | ||
message: string; | ||
type: 'danger' | 'success' | 'info'; | ||
action?: { text: string; onClick: Function }; | ||
icon?: string; | ||
persist?: boolean; | ||
id?: symbol; | ||
dismiss?: () => void; | ||
} | ||
``` | ||
|
||
### How to send notification? | ||
|
||
To send a new notification you need to only import `useUiNotification` from composables and pass `type` and `message` to `send` function. Rest parameters are optional. | ||
|
||
```js | ||
import { useUiNotification } from '~/composables'; | ||
|
||
setup() { | ||
const { send } = useUiNotification(); | ||
|
||
send({ | ||
type: 'success', | ||
message: 'Successfully added product to the cart' | ||
}) | ||
} | ||
``` |