Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue.js + Bootstrap - question - invoking $bvToast from store.js

Tags:

vue.js

I have probably very profoundly simple question: how to invoke methods located in components from store.js, for instance I want a toast popup from store mutation. Any ideas?

like image 737
user2401543 Avatar asked Oct 24 '25 02:10

user2401543


1 Answers

The $bvToast can be found in BToast export. You can import it to use it.

import { BToast } from 'bootstrap-vue'

Example Class

import { BToast } from 'bootstrap-vue'
class uiUtils
{
        showToast(message : string,title : string){

          let bootStrapToaster = new BToast();

          bootStrapToaster.$bvToast.toast(message, {
              title: title,
              toaster: "b-toaster-top-right",
              solid: true,
              appendToast: false
            })
        }
}
export default new uiUtils();

The documentation does show the individual component exports at the bottom of the page and can be found here Bootstrap Vue Documentation.

like image 198
TheBeast Avatar answered Oct 25 '25 23:10

TheBeast