mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user