Skip to content

Commit 338cc1e

Browse files
authored
Merge pull request #787 from Efficy/main
feat(BToast): Add optional parameters autoHide and noCloseButton using on Deman
2 parents 36d86a3 + df581f0 commit 338cc1e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

apps/docs/docs/components/Toast.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Use `toast.show()` method to generate your toasts. The method accepts the follow
3838
- `title` (optional) : string or an array of `VNodes`
3939
- `body` : string or an array of `VNodes`
4040
- `options`: an optional options object for changing position and delay hidden
41+
- `autoHide` (optional) : true/false - by default is true
42+
- `noCloseButton` (optional) : true/false - by default is false
4143
- `pos`: 'top-left', 'top-center', 'top-right', 'middle-left', 'middle-center', 'middle-right', 'bottom-left', 'bottom-center', 'bottom-right'
4244
- `delay`: number
4345
- `variant` : string ColorVariant

packages/bootstrap-vue-3/src/components/BToast/BToaster.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
:id="toast.options.id"
66
:key="toast.options.id"
77
v-model="toast.options.value"
8+
:auto-hide="toast.options.autoHide"
89
:delay="toast.options.delay"
10+
:no-close-button="toast.options.noCloseButton"
911
:title="toast.content.title"
1012
:body="toast.content.body"
1113
:component="toast.content.body"

packages/bootstrap-vue-3/src/components/BToast/plugin.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ export interface ToastContent {
1919
}
2020

2121
export interface ToastOptions {
22-
id?: string
23-
value?: boolean // show or hide
22+
autoHide?: boolean
2423
delay?: number
24+
id?: string
25+
noCloseButton?: boolean
2526
pos?: ContainerPosition
27+
value?: boolean // show or hide
2628
variant?: ColorVariant
2729
}
2830

@@ -50,7 +52,7 @@ interface ToastContainers {
5052
[key: symbol]: ToastVM
5153
}
5254

53-
const defaultToastOptions: ToastOptions = {delay: 5000, value: true, pos: 'top-right'}
55+
const defaultToastOptions: ToastOptions = {autoHide: true, delay: 5000, noCloseButton: false, pos: 'top-right', value: true}
5456

5557
export class ToastInstance {
5658
vm: ToastVM

0 commit comments

Comments
 (0)