debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/dismissible_alert.vue

38 lines
634 B
Vue
Raw Normal View History

2020-03-13 15:44:24 +05:30
<script>
2021-09-30 23:02:18 +05:30
import { GlAlert, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
2020-03-13 15:44:24 +05:30
export default {
2021-09-30 23:02:18 +05:30
name: 'DismissibleAlert',
2020-03-13 15:44:24 +05:30
components: {
GlAlert,
},
2021-09-30 23:02:18 +05:30
directives: {
SafeHtml,
},
2020-03-13 15:44:24 +05:30
props: {
html: {
type: String,
required: false,
default: '',
},
},
data() {
return {
isDismissed: false,
};
},
methods: {
dismiss() {
this.isDismissed = true;
2022-01-26 12:08:38 +05:30
this.$emit('alertDismissed');
2020-03-13 15:44:24 +05:30
},
},
};
</script>
<template>
<gl-alert v-if="!isDismissed" v-bind="$attrs" @dismiss="dismiss" v-on="$listeners">
2021-09-30 23:02:18 +05:30
<div v-safe-html="html"></div>
2020-03-13 15:44:24 +05:30
</gl-alert>
</template>