debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/dismissible_alert.vue
2021-09-30 23:02:18 +05:30

36 lines
598 B
Vue

<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;
},
},
};
</script>
<template>
<gl-alert v-if="!isDismissed" v-bind="$attrs" @dismiss="dismiss" v-on="$listeners">
<div v-safe-html="html"></div>
</gl-alert>
</template>