Skip to content

Bootstrap Vue Toast disapears immediately on Vue plugin #6742

@kicozaninetti

Description

@kicozaninetti

Hello folks.

I want to fire toasts on event add and event remove. I have a plugin managing these events. When I fire the toasts they just blink, disappears immediately.

I have tried changing the scope from this.$bvToast.toast to this.$root.$bvToast.toast but still the same error.

My plugin is like this:

/plugins/user-actions.js

`
export default {

install(Vue, options) {

Vue.prototype.$addUserTalk = function (talk) {

[...]
this.$root.$bvToast.toast('Added event '+talk.title, {
title: 'Added event',
autoHideDelay: 50000,
variant: "success",
appendToast: false
})
}

Vue.prototype.$removeUserTalk = function (talkId) {

[...]

  this.$root.$bvToast.toast('The event '+talkTitle+' was removed', {
    title: 'Event removed',
    autoHideDelay: 50000,
    variant: "danger",
    appendToast: false
  })

}

}
}
`

This is how I call the function from the Component:

addUserTalk(talk) { this.$addUserTalk(talk); this.$emit('update:selectTalk', talk); } deleteEvent(e) { this.$removeUserTalk(e.id); this.getTalks(); }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions