perf: asynchronously load the uppy upload component

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/4875/head
Ryan Wang 2023-11-18 16:08:19 +08:00
parent 747cab3aa1
commit 6f1d86de6d
5 changed files with 8 additions and 5 deletions

View File

@ -6,7 +6,6 @@ import {
VDropdown,
VDropdownItem,
} from "@halo-dev/components";
import UppyUpload from "@/components/upload/UppyUpload.vue";
import { ref, watch } from "vue";
import type { Policy, PolicyTemplate } from "@halo-dev/api-client";
import {

View File

@ -12,7 +12,6 @@ import type { Ref } from "vue";
import { ref } from "vue";
import { useThemeStore } from "@console/stores/theme";
import { apiClient } from "@/utils/api-client";
import UppyUpload from "@/components/upload/UppyUpload.vue";
const { t } = useI18n();
const queryClient = useQueryClient();

View File

@ -1,5 +1,4 @@
<script lang="ts" setup>
import UppyUpload from "@/components/upload/UppyUpload.vue";
import { apiClient } from "@/utils/api-client";
import {
Dialog,

View File

@ -5,7 +5,6 @@ import { Dialog, Toast } from "@halo-dev/components";
import type { SuccessResponse } from "@uppy/core";
import { useI18n } from "vue-i18n";
import { useQueryClient } from "@tanstack/vue-query";
import UppyUpload from "@/components/upload/UppyUpload.vue";
import { computed } from "vue";
import type { UppyFile } from "@uppy/core";
import type { ErrorResponse } from "@uppy/core";

View File

@ -1,5 +1,5 @@
import { defineAsyncComponent, type App } from "vue";
import { VClosePopper, VTooltip } from "@halo-dev/components";
import { VClosePopper, VLoading, VTooltip } from "@halo-dev/components";
import { Dropdown } from "floating-vue";
import "floating-vue/dist/style.css";
// @ts-ignore
@ -39,4 +39,11 @@ export function setupComponents(app: App) {
app.component("AnnotationsForm", AnnotationsForm);
app.component("AttachmentFileTypeIcon", AttachmentFileTypeIcon);
app.component("HasPermission", HasPermission);
app.component(
"UppyUpload",
defineAsyncComponent({
loader: () => import("@/components/upload/UppyUpload.vue"),
loadingComponent: VLoading,
})
);
}