style: interface Emits 先于 defineEmits

This commit is contained in:
dhb52 2024-05-05 01:22:46 +08:00
parent 0e8af7d19b
commit 88ba7406c0
7 changed files with 23 additions and 25 deletions

View File

@ -4,16 +4,16 @@ import { $t } from '@/locales';
import { translateOptions } from '@/utils/common';
import { operationReasonOptions } from '@/constants/business';
const operationReasonRef = ref<Api.Common.OperationReason>();
const emit = defineEmits<Emits>();
interface Emits {
(e: 'update:value', value: Api.Common.OperationReason): void;
}
const emit = defineEmits<Emits>();
const handleUpdate = (operationReason: Api.Common.OperationReason) => {
emit('update:value', operationReason);
};
const operationReasonRef = ref<Api.Common.OperationReason>();
</script>
<template>

View File

@ -8,12 +8,12 @@ defineOptions({
name: 'RouterKey'
});
const routeKeyRef = ref<Api.Common.RouteKey>();
const emit = defineEmits<Emits>();
interface Emits {
(e: 'update:value', value: Api.Common.RouteKey): void;
}
const emit = defineEmits<Emits>();
const routeKeyRef = ref<Api.Common.RouteKey>();
const handleUpdate = (routeKey: Api.Common.RouteKey) => {
emit('update:value', routeKey);

View File

@ -8,17 +8,11 @@ defineOptions({
name: 'SelectGroup'
});
interface Props {
modelValue?: string | null;
}
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const model = defineModel<string | null>();
interface Emits {
(e: 'update:modelValue', value: string): void;
}
const emit = defineEmits<Emits>();
/** 组列表 */
const groupNameList = ref<string[]>([]);
@ -35,9 +29,9 @@ async function getGroupNameList() {
getGroupNameList();
watch(
() => props.modelValue,
() => model,
() => {
groupName.value = props.modelValue!;
groupName.value = model.value!;
},
{ immediate: true }
);

View File

@ -4,6 +4,10 @@ import { $t } from '@/locales';
import { translateOptions2 } from '@/utils/common';
import { fetchGetRetrySceneList } from '@/service/api';
defineOptions({
name: 'SelectScene'
});
const emit = defineEmits<Emits>();
interface Props {

View File

@ -4,12 +4,12 @@ import { $t } from '@/locales';
import { translateOptions } from '@/utils/common';
import { taskBatchStatusRecordOptions } from '@/constants/business';
const taskBatchStatusRef = ref<Api.Common.TaskBatchStatus>();
const emit = defineEmits<Emits>();
interface Emits {
(e: 'update:value', value: Api.Common.TaskBatchStatus): void;
}
const emit = defineEmits<Emits>();
const taskBatchStatusRef = ref<Api.Common.TaskBatchStatus>();
const handleUpdate = (taskBatchStatus: Api.Common.TaskBatchStatus) => {
emit('update:value', taskBatchStatus);

View File

@ -8,12 +8,12 @@ defineOptions({
name: 'TaskType'
});
const valueRef = ref<Api.Common.BlockStrategy>();
const emit = defineEmits<Emits>();
interface Emits {
(e: 'update:value', value: Api.Common.BlockStrategy): void;
}
const emit = defineEmits<Emits>();
const valueRef = ref<Api.Common.BlockStrategy>();
const handleUpdate = (value: Api.Common.BlockStrategy) => {
emit('update:value', value);

View File

@ -8,12 +8,12 @@ defineOptions({
name: 'TriggerType'
});
const valueRef = ref<Api.Common.TriggerType>();
const emit = defineEmits<Emits>();
interface Emits {
(e: 'update:value', value: Api.Common.TriggerType): void;
}
const emit = defineEmits<Emits>();
const valueRef = ref<Api.Common.TriggerType>();
const handleUpdate = (value: Api.Common.TriggerType) => {
emit('update:value', value);