Files
Automata/packages/editor-ui/src/components/PageAlert.vue
Alex Grozav 3e5f7adcbf feat: Remove vue-fragment (no-changelog) (#6456)
* feat: remove vue-fragment (no-changelog)

* Update pnpm-lock.yaml

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-06-16 14:25:12 +03:00

50 lines
879 B
Vue

<template>
<span v-show="false" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import type { ElNotificationComponent } from 'element-ui/types/notification';
import { sanitizeHtml } from '@/utils';
import { useToast } from '@/composables';
export default defineComponent({
name: 'PageAlert',
props: {
message: {
type: String,
required: true,
},
popupClass: {
type: String,
},
},
setup() {
return {
...useToast(),
};
},
data() {
return {
alert: null as null | ElNotificationComponent,
};
},
mounted() {
this.alert = this.showAlert({
title: '',
message: sanitizeHtml(this.message),
type: 'warning',
duration: 0,
showClose: true,
dangerouslyUseHTMLString: true,
customClass: this.popupClass || '',
});
},
beforeDestroy() {
if (this.alert) {
this.alert.close();
}
},
});
</script>