rewrite search tabbing

This commit is contained in:
geoffrey45
2022-09-04 15:30:23 +03:00
parent 24bfa73ab6
commit b7c158a785
12 changed files with 172 additions and 108 deletions
+32 -6
View File
@@ -1,13 +1,39 @@
<template>
<div v-show="name == s.currentTab">
<slot />
</div>
<component :is="getComponent()?.component" v-bind="getComponent()?.props" />
</template>
<script setup lang="ts">
import useSearchStore from "@/stores/search";
const s = useSearchStore();
defineProps<{
import ArtistGrid from "./ArtistGrid.vue";
import TracksGrid from "./TracksGrid.vue";
const props = defineProps<{
name: string;
isOnSearchPage?: boolean;
}>();
function getComponent() {
switch (props.name) {
case "tracks":
return {
component: TracksGrid,
props: {
isOnSearchPage: props.isOnSearchPage,
},
};
case "albums":
return {
component: ArtistGrid,
props: {
album_grid: true,
},
};
case "artists":
return {
component: ArtistGrid,
props: {},
};
default:
return null;
}
}
</script>