From 06159026320150ea8bb96ae6e10dd8641deb79a2 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Mon, 1 Nov 2021 13:31:49 +0800 Subject: [PATCH] perf: home page --- package.json | 1 + src/main.ts | 8 ++- src/views/welcome.vue | 152 ++++++++++++++++++++++++++++++++---------- yarn.lock | 41 +++++++++++- 4 files changed, 164 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 8153a2c4d..5e3bafa93 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@logicflow/core": "^0.7.1", "@logicflow/extension": "^0.7.1", "@vueuse/core": "^6.7.1", + "@vueuse/motion": "^2.0.0-beta.4", "animate.css": "^4.1.1", "await-to-js": "^3.0.0", "axios": "^0.21.1", diff --git a/src/main.ts b/src/main.ts index e90af529f..22d70738a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import { setupStore } from "/@/store"; import { getServerConfig } from "./config"; import { createApp, Directive } from "vue"; import { usI18n } from "../src/plugins/i18n"; +import { MotionPlugin } from "@vueuse/motion"; import { useTable } from "../src/plugins/vxe-table"; import { useElementPlus } from "../src/plugins/element-plus"; import { injectResponsiveStorage } from "/@/utils/storage/responsive"; @@ -27,7 +28,12 @@ Object.keys(directives).forEach(key => { getServerConfig(app).then(async config => { injectResponsiveStorage(app, config); setupStore(app); - app.use(router).use(useElementPlus).use(useTable).use(usI18n); + app + .use(router) + .use(MotionPlugin) + .use(useElementPlus) + .use(useTable) + .use(usI18n); await router.isReady(); app.mount("#app"); }); diff --git a/src/views/welcome.vue b/src/views/welcome.vue index 945830624..e4f0664d4 100644 --- a/src/views/welcome.vue +++ b/src/views/welcome.vue @@ -13,7 +13,7 @@ let loading = ref(true); setTimeout(() => { loading.value = !loading.value; -}, 500); +}, 800); let greetings = computed(() => { if (date.getHours() >= 0 && date.getHours() < 12) { @@ -51,15 +51,31 @@ const openDepot = (): void => { :lg="12" :xl="12" style="margin-bottom: 20px" + v-motion + :initial="{ + opacity: 0, + y: 100 + }" + :enter="{ + opacity: 1, + y: 0, + transition: { + delay: 200 + } + }" > - -