refactor: typing component template refs for VModal (#5994)

#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

#### What this PR does / why we need it:

为 VModal 组件的引用添加类型。

See https://vuejs.org/guide/typescript/composition-api.html#typing-component-template-refs

#### Does this PR introduce a user-facing change?

```release-note
None
```
This commit is contained in:
Ryan Wang
2024-05-27 16:56:57 +08:00
committed by GitHub
parent 22ce60b0e9
commit afabffc546
29 changed files with 79 additions and 79 deletions

View File

@@ -28,7 +28,7 @@ const emit = defineEmits<{
const { t } = useI18n();
const modal = ref();
const modal = ref<InstanceType<typeof VModal> | null>(null);
const selectedParentMenuItem = ref<string>("");
const formState = ref<MenuItem>({
spec: {
@@ -121,7 +121,7 @@ const handleSaveMenuItem = async () => {
emit("saved", data);
}
modal.value.close();
modal.value?.close();
Toast.success(t("core.common.toast.save_success"));
} catch (e) {
@@ -381,7 +381,7 @@ onMounted(() => {
@submit="$formkit.submit('menuitem-form')"
>
</SubmitButton>
<VButton @click="modal.close()">
<VButton @click="modal?.close()">
{{ $t("core.common.buttons.cancel_and_shortcut") }}
</VButton>
</VSpace>