euvl / vue-notification

:icecream: Vue.js 2 library for showing notifications
http://vue-notification.yev.io/
MIT License
2.39k stars 213 forks source link

Use <notifications> element globally in a layout instead of individual vue files #226

Closed sts-ryan-holton closed 3 years ago

sts-ryan-holton commented 3 years ago

Is your feature request related to a problem? Please describe.

I currently have many pages inside my Nuxt JS application, and I'm finding myself having to repeat the <notifications> element many times over in each and every *.vue file where I'd like to use this.$notify()

Describe the solution you'd like

I'd like to be able to add my notification template into a layout, for instance:

<template>
  <div>

    <!-- Notifications -->
    <notifications width="340px">
      <template slot="body" slot-scope="{ item, close }">
        <div @click="close">
          <Toast :data="item" />
        </div>
      </template>
    </notifications>

    <!-- View -->
    <nuxt />

  </div>
</template>

Describe alternatives you've considered

Currently use the notifications element in individual vue files, but I'm sure there's a better way.

Additional context

For context, in my example: <Toast> is a component I've set up, and is imported globally into the project in Nuxt JS

github-actions[bot] commented 3 years ago

Stale issue message