2022-11-01 10:32:53 +00:00
|
|
|
<template>
|
2022-11-01 12:12:54 +00:00
|
|
|
<component :is="compName" :item="item" />
|
|
|
|
</template>
|
2022-11-01 10:32:53 +00:00
|
|
|
|
2022-11-01 12:12:54 +00:00
|
|
|
<script setup>
|
|
|
|
import { defineAsyncComponent } from "vue";
|
2022-11-01 10:32:53 +00:00
|
|
|
|
2022-11-01 12:12:54 +00:00
|
|
|
const props = defineProps({
|
2023-07-27 11:46:05 +00:00
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2022-11-01 12:12:54 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const VideoItem = defineAsyncComponent(() => import("./VideoItem.vue"));
|
|
|
|
const PlaylistItem = defineAsyncComponent(() => import("./PlaylistItem.vue"));
|
|
|
|
const ChannelItem = defineAsyncComponent(() => import("./ChannelItem.vue"));
|
|
|
|
|
|
|
|
var compName;
|
2022-11-01 10:32:53 +00:00
|
|
|
|
2022-11-01 12:12:54 +00:00
|
|
|
switch (props.item?.type) {
|
|
|
|
case "stream":
|
|
|
|
compName = VideoItem;
|
|
|
|
break;
|
|
|
|
case "playlist":
|
|
|
|
compName = PlaylistItem;
|
|
|
|
break;
|
|
|
|
case "channel":
|
|
|
|
compName = ChannelItem;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
console.error("Unexpected item type: " + props.item.type);
|
|
|
|
}
|
2022-11-01 10:32:53 +00:00
|
|
|
|
2022-11-01 12:12:54 +00:00
|
|
|
defineExpose({
|
|
|
|
compName,
|
|
|
|
});
|
2022-11-01 10:32:53 +00:00
|
|
|
</script>
|