f3oall/vue-awesome-notifications

Cannot read property 'success' of undefined

Closed this issue · 2 comments

I use laravel. So in my bootstrap.js I try

import VueAWN from "vue-awesome-notifications"
let options = {
};
Vue.use(VueAWN, options);
require("vue-awesome-notifications/dist/styles/style.css");
this.$awn.success("Your custom message");

and get error

Cannot read property 'success' of undefined

In components it works fine. But in file where I define Vue and import VueAWN - it is not works.

I'm not familiar with laravel, but probably the issue is happen because this in the initialization file isn't the Vue instance

HEEEEEEEEEELP!

I'm ussing Quasar and MATERIAL ICONS... so my prefix for icons (https://quasar.dev/vue-components/icon#Webfont-icons) is <q-icon name="..." />
import Vue from 'vue'
import './quasar'
import VueAWN from "vue-awesome-notifications"
let options = {
prefix: "<q-icon name='",
sucess: "face",
suffix: "<' />"
};
Vue.use(VueAWN, options);
require("vue-awesome-notifications/dist/styles/style.css");

And in my XComponent.vue everything is OK but my custom ICON is not showing
this.$awn.success("Your custom message");