Merge pull request #4875 from ruibaby/perf/asynchronously-load-uppy-upload

perf: asynchronously load the uppy upload component
pull/4919/head
John Niang 2023-11-27 16:57:06 +08:00 committed by GitHub
commit c02911ce01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,
})
);
}