f3oall / vue-awesome-notifications

Vue.js version of Awesome Notifications library
MIT License
104 stars 10 forks source link

Cannot read property 'success' of undefined #4

Closed n-osennij closed 5 years ago

n-osennij commented 6 years ago

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.

f3oall commented 5 years ago

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

davidreyg commented 4 years ago

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");