2022-11-01 16:02:53 +05:30
|
|
|
<template>
|
2022-11-01 17:42:54 +05:30
|
|
|
<component :is="compName" :item="item" />
|
|
|
|
</template>
|
2022-11-01 16:02:53 +05:30
|
|
|
|
2022-11-01 17:42:54 +05:30
|
|
|
<script setup>
|
|
|
|
import { defineAsyncComponent } from "vue";
|
2022-11-01 16:02:53 +05:30
|
|
|
|
2022-11-01 17:42:54 +05:30
|
|
|
const props = defineProps({
|
2023-07-27 17:16:05 +05:30
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2022-11-01 17:42:54 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
const VideoItem = defineAsyncComponent(() => import("./VideoItem.vue"));
|
|
|
|
const PlaylistItem = defineAsyncComponent(() => import("./PlaylistItem.vue"));
|
|
|
|
const ChannelItem = defineAsyncComponent(() => import("./ChannelItem.vue"));
|
|
|
|
|
|
|
|
var compName;
|
2022-11-01 16:02:53 +05:30
|
|
|
|
2022-11-01 17:42:54 +05:30
|
|
|
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 16:02:53 +05:30
|
|
|
|
2022-11-01 17:42:54 +05:30
|
|
|
defineExpose({
|
|
|
|
compName,
|
|
|
|
});
|
2022-11-01 16:02:53 +05:30
|
|
|
</script>
|