File tree 3 files changed +12
-6
lines changed 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 17
17
Dismissible Alert!
18
18
</b-alert >
19
19
20
- <b-alert :show =" dismissCountDown" dismissible variant =" warning" @dismiss-count-down =" countDownChanged" >
20
+ <b-alert :show =" dismissCountDown" variant =" warning" @dismiss-count-down =" countDownChanged" >
21
21
This alert will dismiss after {{dismissCountDown}} seconds...
22
22
</b-alert >
23
23
@@ -76,3 +76,5 @@ with the dismiss button.
76
76
#### Auto dismissing alerts:
77
77
To create a ` <b-alert> ` that dismisses automatically after a period of time, set
78
78
the ` show ` prop to the number of seconds you would like the ` <b-alert> ` to remain visible for.
79
+
80
+ Note that the dismiss button will not be shown for auto-dismissing alerts.
Original file line number Diff line number Diff line change 22
22
</ b-alert >
23
23
24
24
< b-alert :show ="dismissCountDown "
25
- dismissible
26
25
variant ="warning "
27
26
@dismiss-count-down ="countDownChanged "
28
27
>
34
33
< b-btn @click ="showDismissibleAlert=true " variant ="info " class ="m-1 " ref ="dismissible_alert_btn ">
35
34
Show dismissible alert ({{showDismissibleAlert?'visible':'hidden'}})
36
35
</ b-btn >
37
- </ div >
36
+ </ div >
Original file line number Diff line number Diff line change 9
9
class =" close"
10
10
data-dismiss =" alert"
11
11
:aria-label =" dismissLabel"
12
- v-if =" dismissible "
12
+ v-if =" localDismissible "
13
13
@click.stop.prevent =" dismiss"
14
14
>
15
15
<span aria-hidden =" true" >× ; </span >
25
25
data () {
26
26
return {
27
27
countDownTimerId: null ,
28
- dismissed: false
28
+ dismissed: false ,
29
+ localDismissible: this .dismissible
29
30
};
30
31
},
31
32
created () {
35
36
},
36
37
computed: {
37
38
classObject () {
38
- return [' alert' , this .alertVariant , this .dismissible ? ' alert-dismissible' : ' ' ];
39
+ return [' alert' , this .alertVariant , this .localDismissible ? ' alert-dismissible' : ' ' ];
39
40
},
40
41
alertVariant () {
41
42
const variant = this .state || this .variant || ' info' ;
92
93
93
94
// No timer for boolean values
94
95
if (this .show === true || this .show === false || this .show === null || this .show === 0 ) {
96
+ this .localDismissible = this .dismissible ;
95
97
return ;
96
98
}
97
99
100
+ // Hide dismiss button for auto-dismissing
101
+ this .localDismissible = false ;
102
+
98
103
let dismissCountDown = this .show ;
99
104
this .$emit (' dismiss-count-down' , dismissCountDown);
100
105
You can’t perform that action at this time.
0 commit comments