mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-16 01:24:05 -08:00
50 lines
875 B
Vue
50 lines
875 B
Vue
<template>
|
|
<span v-show="false" />
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent } from 'vue';
|
|
import type { NotificationInstance } from 'element-plus';
|
|
import { sanitizeHtml } from '@/utils/htmlUtils';
|
|
import { useToast } from '@/composables/useToast';
|
|
|
|
export default defineComponent({
|
|
name: 'PageAlert',
|
|
props: {
|
|
message: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
popupClass: {
|
|
type: String,
|
|
},
|
|
},
|
|
setup() {
|
|
return {
|
|
...useToast(),
|
|
};
|
|
},
|
|
data() {
|
|
return {
|
|
alert: null as null | NotificationInstance,
|
|
};
|
|
},
|
|
mounted() {
|
|
this.alert = this.showAlert({
|
|
title: '',
|
|
message: sanitizeHtml(this.message),
|
|
type: 'warning',
|
|
duration: 0,
|
|
showClose: true,
|
|
dangerouslyUseHTMLString: true,
|
|
customClass: this.popupClass || '',
|
|
});
|
|
},
|
|
beforeUnmount() {
|
|
if (this.alert) {
|
|
this.alert.close();
|
|
}
|
|
},
|
|
});
|
|
</script>
|