Skip to content

Commit 5760c04

Browse files
committed
Client Side Toast Fix
1 parent f9275eb commit 5760c04

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/.vuepress/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineClientConfig({
99
if (!__VUEPRESS_SSR__) {
1010
const {BootstrapVue3, BToastPlugin} = await import('../../dist/bootstrap-vue-3.es')
1111
app.use(BootstrapVue3)
12-
app.use(BToastPlugin)
12+
app.use(BToastPlugin, {BToast: {injectkey: 'toast'}})
1313
app.component('doc-reference', DocReference)
1414
}
1515
},

docs/components/Toast.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,13 @@ Toasts can be displayed as variants thru various helper methods or be set in `To
135135
</ClientOnly>
136136

137137
<script lang='ts' setup>
138-
import {ref, computed} from 'vue';
138+
import {ref, computed, inject} from 'vue';
139139
import {useToast} from 'bootstrap-vue-3';
140+
let toast = null
141+
142+
if (!__VUEPRESS_SSR__) {
143+
toast = inject("toast").useToast()
140144

141-
// let toast = useToast()
142145

143146
let show1 = () => {toast.show({title: 'example title'})};
144147
let show2 = () => {toast.show({title: 'example title', body: "This is a toast"}, {variant: 'info'})};
@@ -147,4 +150,5 @@ Toasts can be displayed as variants thru various helper methods or be set in `To
147150
let variantshow2 = () => {toast.show({title: 'New Message', body: "This is a toast"}, {pos: 'bottom-right', variant: 'info'})};
148151
let variantshow3 = () => {toast.show({title: 'Warning for Item', body: "Please check list"},{pos: 'bottom-right', variant: 'warning'})};
149152
let variantshow4 = () => {toast.show({title: 'Event Created!', body: "Bootstrap Event"},{pos: 'bottom-right', variant: 'success'})};
153+
}
150154
</script>

0 commit comments

Comments
 (0)