Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue3 Support #198

Closed
aurium opened this issue Oct 6, 2020 · 10 comments
Closed

Vue3 Support #198

aurium opened this issue Oct 6, 2020 · 10 comments

Comments

@aurium
Copy link

aurium commented Oct 6, 2020

Is your feature request related to a problem? Please describe.
vue-notification is not compatible to Vue3.

Describe the solution you'd like
I want to use vue-notification in a Vue3 app.

Describe alternatives you've considered
The alternative is to use another notification component.

@mcdis
Copy link

mcdis commented Oct 22, 2020

  1. I've replace new Vue() like event bus on this
class Event {
  constructor() {
    this.events = {};
  }

  on(eventName, fn) {
    this.events[eventName] = this.events[eventName] || [];
    this.events[eventName].push(fn);
  }

  off(eventName, fn) {
    if (this.events[eventName]) {
      for (let i = 0; i < this.events[eventName].length; i++) {
        if (this.events[eventName][i] === fn) {
          this.events[eventName].splice(i, 1);
          break;
        }
      }
    }
  }

  emit(eventName, data) {
    if (this.events[eventName]) {
      this.events[eventName].forEach(function (fn) {
        fn(data);
      });
    }
  }
}

export default new Event();
  1. remove velocity plugin

and it works...

@lewis-munyi
Copy link

How do I use this in Vue 3? I keep getting the error
index.js?ee98:146 Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0_vue___default.a is not a constructor

// main.js

import Notifications from 'vue-notification'

const app = createApp(App)
app.use(store)
	.use(router)
	.use(Notifications)
	.mount('#app')

// Vue component

this.$notify({
                group: 'auth',
                title: 'Important message',
                text: 'Hello user! This is a notification!',
            })

How do I fix this?

@dacoto97
Copy link

+1

1 similar comment
@professrr
Copy link

+1

@RRicardotj
Copy link

Same here, I'm try to use it in Vue 3, but it's not working. I get the error
index.js?ee98:146 Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0_vue___default.a is not a constructor

@j-jalving
Copy link

+1

@kyvg
Copy link

kyvg commented Apr 15, 2021

@RRicardotj @j-jalving @dacoto97
It is look like this repo not maintained anymore. I forked this repo and rewrite in TypeScript and Vue 3, you can try it here:
https://github.com/kyvg/vue3-notification

@github-actions
Copy link

Stale issue message

@dacoto97
Copy link

Is there any news?

@Glideh Glideh mentioned this issue Sep 1, 2021
@patrick-motard
Copy link

This repo should be marked as archived if this is the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants