feat: 🚀 订阅功能
This commit is contained in:
34
src/layouts/indexAsync.vue
Normal file
34
src/layouts/indexAsync.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<!-- 💥 这里是异步加载 LayoutComponents -->
|
||||
<template>
|
||||
<suspense>
|
||||
<template #default>
|
||||
<component :is="LayoutComponents[layout]" />
|
||||
</template>
|
||||
<template #fallback>
|
||||
<Loading />
|
||||
</template>
|
||||
</suspense>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="layoutAsync">
|
||||
import { computed, defineAsyncComponent, type Component } from "vue";
|
||||
// import { LayoutType } from "@/stores/interface";
|
||||
import { useGlobalStore } from "@/stores/modules/global";
|
||||
import Loading from "@/components/Loading/index.vue";
|
||||
|
||||
const LayoutComponents: Record<any, Component> = {
|
||||
vertical: defineAsyncComponent(() => import("./LayoutVertical/index.vue")),
|
||||
classic: defineAsyncComponent(() => import("./LayoutClassic/index.vue")),
|
||||
transverse: defineAsyncComponent(() => import("./LayoutTransverse/index.vue")),
|
||||
columns: defineAsyncComponent(() => import("./LayoutColumns/index.vue"))
|
||||
};
|
||||
|
||||
const globalStore = useGlobalStore();
|
||||
const layout = computed(() => globalStore.layout);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout {
|
||||
min-width: 730px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user