vmAlert
This is a VueJs Library for notification in your application
Installation
npm install --save vm-alert
Usage
In your main.js. kindly do this as this component has been registered globally:
import 'vm-alert';
Kindly load the component once in a global visible template like in App.vue
<vm-alert></vm-alert>
What matters is to use the vm-alert service to push message. in any script part of your SFC or Separated File component. Please do this
import vAlertService from "vm-alert";
You can decide to use the following methods based on what you want to alert.
EG: `vAlertService.success('Hello World')`
We have the following methods you can use to notify and message passed can be a SafeHTML or string.
success: for success alert. Accepts HTML | string
warning: for warning alert. Accepts HTML | string
info: for information alert. Accepts HTML | string
error: for error alert (This can accept default message and optional backend error, if backend response error is passed, this will be used). Accepts Object | Array<HTML | string> | Array<Object>
clear: to destroy current open alert but alert disappears based on configured time.
vm-alert can be used as an:
Overlay: This is best used while the <vm-alert></vm-alert> is reference in a top level component that is always visible throughout the entire state of the angular app. such as usage in app.component and header layout component of your application.
No Overlay: This is best used if you need to override the overlay approach for a specific component and render it in that current component content. <vm-alert [overlay]="false"></vm-alert>. you can also choose to use this alert in every component like this but it is not advisable to do so.
You can also import ALERT_TIMEOUT and set the value in seconds