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

https://github.com/koumoul-dev/notif-vue

Small utility to manage notifications in vuejs applications.
https://github.com/koumoul-dev/notif-vue

Last synced: 6 months ago
JSON representation

Small utility to manage notifications in vuejs applications.

Awesome Lists containing this project

README

          

# notif-vue

Small utility to manage notifications in vuejs applications.

## Example integration

In you store:

```
import Vue from 'vue'
import Vuex from 'vuex'
import {notificationStore} from './notif-vue'

Vue.use(Vuex)

export default () => {
return new Vuex.Store({
modules: {notification: notificationStore},
actions: {
async doStuff() {
try {
await ...doing stuff
dispatch('notification/queue', 'Stuff done')
} catch(error) {
dispatch('notification/queue', {error, msg: 'Error while doing stuff'})
}
}
}
})
}
```

In your page (example with [vuetify](https://vuetifyjs.com)):

```


...


...


{{ notif.msg }}


{{ notif.errorMsg }}



close


import {mapState, mapGetters} from 'vuex'

export default {
computed: {
...mapState('notification', ['notif'])
}
}

body .application {
.notification .v-snack__content {
height: auto;
p {
margin-bottom: 4px;
margin-top: 4px;
}
}
}

```