Skip to content

Commit

Permalink
Switch AlertNotify handler to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Oct 30, 2024
1 parent 7bd4b33 commit 79acca2
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/components/AlertNotify.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<script setup>
<script setup lang="ts">
import { watch } from "vue";
import { NAlert } from "naive-ui";
type MessageVariantType = "info" | "default" | "warning" | "error" | "success" | undefined;
const MESSAGE_TIMEOUT = 2000;
const props = defineProps({
message: {
type: String,
required: true,
},
messageType: {
type: String,
default: "info",
const props = withDefaults(
defineProps<{
message: string;
messageType?: MessageVariantType;
}>(),
{
messageType: "info",
},
});
);
const emit = defineEmits(["timeout"]);
// Watch and clear messages
let timeoutMessage = null;
let timeoutMessage: ReturnType<typeof setTimeout> | null = null;
watch(
() => props.message,
() => {
Expand Down

0 comments on commit 79acca2

Please sign in to comment.