我可能有一个非常简单的问题:如何从 store.js 调用位于组件中的方法,例如我想要一个来自 store 突变的 toast 弹出窗口。有任何想法吗?
小智 8
$bvToast 可以在 BToast 导出中找到。您可以导入它以使用它。
import { BToast } from 'bootstrap-vue'
Run Code Online (Sandbox Code Playgroud)
示例类
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();
Run Code Online (Sandbox Code Playgroud)
该文档确实在页面底部显示了各个组件导出,可以在此处找到Bootstrap Vue 文档。