[ui] Vue 3 - Migrated InlineAlert component
</template>
<script lang="ts">
- import Vue from 'vue';
- import Component from 'vue-class-component';
- import { Prop } from 'vue-property-decorator';
+ import { defineComponent, PropType } from 'vue';
+
import I18n from 'utils/i18n';
export enum AlertType {
[AlertType.Unknown, UNKNOWN_DEF]
]);
- @Component({
- methods: {
- I18n
- }
- })
- export default class InlineAlert extends Vue {
- @Prop({ required: true, default: AlertType.Unknown })
- type!: AlertType;
-
- @Prop()
- message!: string;
- @Prop()
- details!: string;
-
- @Prop({ default: false })
- showClose!: boolean;
-
- showDetails = false;
-
- get definition(): AlertDef {
+ export default defineComponent({
+ props: {
+ type: {
+ type: Object as PropType<AlertType>,
+ required: true,
+ default: AlertType.Unknown
+ },
+
+ message: {
+ type: String,
+ default: undefined
+ },
+ details: {
+ type: String,
+ default: undefined
+ },
+
+ showClose: Boolean
+ },
+
+ emits: ['close'],
+
+ data(): {
+ showDetails: boolean;
+ } {
+ return {
+ showDetails: false
+ };
+ },
+
+ computed: {
+ definition(): AlertDef {
return TYPE_DEFS.get(this.type) || UNKNOWN_DEF;
}
+ },
+
+ methods: {
+ I18n
}
+ });
</script>
<style lang="scss" scoped>
