From a280993c6d459acddf827de787ed722e49613534 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 9 Aug 2017 22:24:46 -0300 Subject: [PATCH 1/3] feat(alert): Hide dismiss button for auto-dismissing --- lib/components/alert.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/components/alert.vue b/lib/components/alert.vue index c826af127d8..9072bd22f64 100755 --- a/lib/components/alert.vue +++ b/lib/components/alert.vue @@ -9,7 +9,7 @@ class="close" data-dismiss="alert" :aria-label="dismissLabel" - v-if="dismissible" + v-if="localDismissible" @click.stop.prevent="dismiss" > @@ -25,7 +25,8 @@ data() { return { countDownTimerId: null, - dismissed: false + dismissed: false, + localDismissible: this.dismissible }; }, created() { @@ -35,7 +36,7 @@ }, computed: { classObject() { - return ['alert', this.alertVariant, this.dismissible ? 'alert-dismissible' : '']; + return ['alert', this.alertVariant, this.localDismissible ? 'alert-dismissible' : '']; }, alertVariant() { const variant = this.state || this.variant || 'info'; @@ -92,9 +93,13 @@ // No timer for boolean values if (this.show === true || this.show === false || this.show === null || this.show === 0) { + this.localDismissible = this.dismissible; return; } + // Hide dismiss button for auto-dismissing + this.localDismissible = false; + let dismissCountDown = this.show; this.$emit('dismiss-count-down', dismissCountDown); From f3d7437d3c950a81a5f61b850f92191ed280737d Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 9 Aug 2017 22:27:12 -0300 Subject: [PATCH 2/3] [lert] Update README.md --- docs/components/alert/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/components/alert/README.md b/docs/components/alert/README.md index bedee189d8f..47b5fc6df37 100755 --- a/docs/components/alert/README.md +++ b/docs/components/alert/README.md @@ -17,7 +17,7 @@ Dismissible Alert! - + This alert will dismiss after {{dismissCountDown}} seconds... @@ -76,3 +76,5 @@ with the dismiss button. #### Auto dismissing alerts: To create a `` that dismisses automatically after a period of time, set the `show` prop to the number of seconds you would like the `` to remain visible for. + +Note that the dismiss button will not be shown for auto-dismissing alerts. From a85e45067562dee2918ac47dea7e1c1429044be7 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 9 Aug 2017 22:29:53 -0300 Subject: [PATCH 3/3] [alert] update example files Remove dismissible from countdown alert --- examples/alert/demo.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/alert/demo.html b/examples/alert/demo.html index de4a314785e..f2d60aacb16 100755 --- a/examples/alert/demo.html +++ b/examples/alert/demo.html @@ -22,7 +22,6 @@ @@ -34,4 +33,4 @@ Show dismissible alert ({{showDismissibleAlert?'visible':'hidden'}}) - \ No newline at end of file +