fix(home): 支持首页组件显示顺序自定义

This commit is contained in:
BTMuli
2023-04-03 09:39:45 +08:00
parent 87370c4d9e
commit cd3084817d
3 changed files with 62 additions and 6 deletions

View File

@@ -1,11 +1,10 @@
<template>
<t-pool v-if="homeStore.pool.show" />
<t-position v-if="homeStore.position.show" />
<t-calendar v-if="homeStore.calendar.show" />
<component v-for="item in components" :is="item" :key="item" />
</template>
<script lang="ts" setup>
// vue
import { shallowRef, onMounted } from "vue";
import TPool from "../components/t-pool.vue";
import TPosition from "../components/t-position.vue";
import TCalendar from "../components/t-calendar.vue";
@@ -13,4 +12,24 @@ import TCalendar from "../components/t-calendar.vue";
import useHomeStore from "../store/modules/home";
const homeStore = useHomeStore();
const showItems = homeStore.getShowValue();
const components = shallowRef([] as any[]);
onMounted(() => {
showItems.map(item => {
switch (item) {
case "限时祈愿":
components.value.push(TPool);
break;
case "近期活动":
components.value.push(TPosition);
break;
case "素材日历":
components.value.push(TCalendar);
break;
default:
break;
}
});
});
</script>