First, thanks for an excellent project, this is the best Vue toast library out there.
I seem to be getting the following error when using a custom toast.
This didn't happen in 1.1.15, I just upgraded today to 1.1.18, tested and the error occurs in 1.1.16 as well. I reworked this code from an older style but I still get the error.
As you can see I have defaults set for normal toasts and I register a global toast. Add this to a boilerplate vue-cli main.js to reproduce along with the App.vue below.
Vue.use(Toasted, {
position: 'top-right',
duration: 5000,
theme: 'primary'
})
Vue.toasted.register('fooNotification',
(thisVue) => {
// Normally I use thisVue in here to resolve some routes from thisVue.$router
var toastContent = '<p>some toast content</p>'
return toastContent
},
{type: 'info',
position: 'bottom-right',
duration: null,
className: 'foo',
onComplete: function () {
// foo
},
action: {
text: 'X',
onClick: (e, toastObject) => {
// foo
toastObject.goAway(0)
}
}
}
)
I activate this global toast in App.vue as part of the created hook. The error occurs regardless of where/when I activate the toast.
<template>
<div id="app">
</div>
</template>
<script>
export default {
name: 'app',
methods: {
fooNotification: function () {
this.$toasted.global.fooNotification(this)
}
},
created: function () {
this.fooNotification()
}
}
</script>
Thanks for taking a look.