mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
fix(home): 支持首页组件显示顺序自定义
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user