Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ctf0/vue-notif

vuejs notification component which you can use either through js or html
https://github.com/ctf0/vue-notif

notifications vuejs vuejs-components

Last synced: 11 days ago
JSON representation

vuejs notification component which you can use either through js or html

Awesome Lists containing this project

README

        


Vue Notif


npm npm

## Installation

```bash
npm install vue-notif --save
```


## Usage

- register the component "we use ***Bulma*** for styling the notification cards".

```js
import Vue from 'vue'
window.EventHub = require('vuemit')

Vue.component('MyNotification', require('vue-notif').default)
```

- add the component to your page

```html




```

- now call it either

+ from html

```html





```

+ or from js

```js
EventHub.fire('showNotif', {
title: 'title',
body: 'body',
type: 'success',
duration: 1,
icon: false,
onClose(){
// what happen when notification is closed
}
});
```

| prop | required | type | default |
| -------- | -------- | -------- | -------------------------------------------- |
| title | :x: | string | null |
| body | :x: | string | null |
| type | :x: | string | info |
| duration | :x: | number | in seconds / null "card will remain visible" |
| icon | :x: | bool | true |
| onClose | :x: | function | null |

- clicking the card itself will dismiss the notification as well.


### Security

If you discover any security-related issues, please email [[email protected]](mailto:[email protected]).