n8n/packages/editor-ui/src/components/PageAlert.vue
Iván Ovejero 5ca2148c7e
refactor(editor): Apply Prettier (no-changelog) (#4920)
*  Adjust `format` script

* 🔥 Remove exemption for `editor-ui`

* 🎨 Prettify

* 👕 Fix lint
2022-12-14 10:04:10 +01:00

46 lines
839 B
Vue

<template>
<fragment></fragment>
</template>
<script lang="ts">
import mixins from 'vue-typed-mixins';
import { showMessage } from '@/mixins/showMessage';
import type { ElMessageComponent } from 'element-ui/types/message';
import { sanitizeHtml } from '@/utils';
export default mixins(showMessage).extend({
name: 'PageAlert',
props: {
message: {
type: String,
required: true,
},
popupClass: {
type: String,
},
},
data() {
return {
alert: null as null | ElMessageComponent,
};
},
mounted() {
this.alert = this.$showAlert({
message: sanitizeHtml(this.message),
type: 'warning',
duration: 0,
showClose: true,
dangerouslyUseHTMLString: true,
// @ts-ignore
customClass: this.popupClass || '',
});
},
beforeDestroy() {
if (this.alert) {
this.alert.close();
}
},
});
</script>