gitlab-org--gitlab-foss/app/assets/javascripts/vue_shared/components/dismissible_alert.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
634 B
Vue
Raw Normal View History

<script>
import { GlAlert, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
export default {
name: 'DismissibleAlert',
components: {
GlAlert,
},
directives: {
SafeHtml,
},
props: {
html: {
type: String,
required: false,
default: '',
},
},
data() {
return {
isDismissed: false,
};
},
methods: {
dismiss() {
this.isDismissed = true;
this.$emit('alertDismissed');
},
},
};
</script>
<template>
<gl-alert v-if="!isDismissed" v-bind="$attrs" @dismiss="dismiss" v-on="$listeners">
<div v-safe-html="html"></div>
</gl-alert>
</template>