mirror of https://github.com/halo-dev/halo
perf: asynchronously load the uppy upload component
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/4875/head
parent
747cab3aa1
commit
6f1d86de6d
|
@ -6,7 +6,6 @@ import {
|
||||||
VDropdown,
|
VDropdown,
|
||||||
VDropdownItem,
|
VDropdownItem,
|
||||||
} from "@halo-dev/components";
|
} from "@halo-dev/components";
|
||||||
import UppyUpload from "@/components/upload/UppyUpload.vue";
|
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import type { Policy, PolicyTemplate } from "@halo-dev/api-client";
|
import type { Policy, PolicyTemplate } from "@halo-dev/api-client";
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import type { Ref } from "vue";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useThemeStore } from "@console/stores/theme";
|
import { useThemeStore } from "@console/stores/theme";
|
||||||
import { apiClient } from "@/utils/api-client";
|
import { apiClient } from "@/utils/api-client";
|
||||||
import UppyUpload from "@/components/upload/UppyUpload.vue";
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import UppyUpload from "@/components/upload/UppyUpload.vue";
|
|
||||||
import { apiClient } from "@/utils/api-client";
|
import { apiClient } from "@/utils/api-client";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { Dialog, Toast } from "@halo-dev/components";
|
||||||
import type { SuccessResponse } from "@uppy/core";
|
import type { SuccessResponse } from "@uppy/core";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useQueryClient } from "@tanstack/vue-query";
|
import { useQueryClient } from "@tanstack/vue-query";
|
||||||
import UppyUpload from "@/components/upload/UppyUpload.vue";
|
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import type { UppyFile } from "@uppy/core";
|
import type { UppyFile } from "@uppy/core";
|
||||||
import type { ErrorResponse } from "@uppy/core";
|
import type { ErrorResponse } from "@uppy/core";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { defineAsyncComponent, type App } from "vue";
|
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 { Dropdown } from "floating-vue";
|
||||||
import "floating-vue/dist/style.css";
|
import "floating-vue/dist/style.css";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -39,4 +39,11 @@ export function setupComponents(app: App) {
|
||||||
app.component("AnnotationsForm", AnnotationsForm);
|
app.component("AnnotationsForm", AnnotationsForm);
|
||||||
app.component("AttachmentFileTypeIcon", AttachmentFileTypeIcon);
|
app.component("AttachmentFileTypeIcon", AttachmentFileTypeIcon);
|
||||||
app.component("HasPermission", HasPermission);
|
app.component("HasPermission", HasPermission);
|
||||||
|
app.component(
|
||||||
|
"UppyUpload",
|
||||||
|
defineAsyncComponent({
|
||||||
|
loader: () => import("@/components/upload/UppyUpload.vue"),
|
||||||
|
loadingComponent: VLoading,
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue