mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-12-16 23:30:27 +05:30
39 lines
827 B
Vue
39 lines
827 B
Vue
<template>
|
|
<component :is="compName" :item="item" />
|
|
</template>
|
|
|
|
<script setup>
|
|
import { defineAsyncComponent } from "vue";
|
|
|
|
const props = defineProps({
|
|
item: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
const VideoItem = defineAsyncComponent(() => import("./VideoItem.vue"));
|
|
const PlaylistItem = defineAsyncComponent(() => import("./PlaylistItem.vue"));
|
|
const ChannelItem = defineAsyncComponent(() => import("./ChannelItem.vue"));
|
|
|
|
var compName;
|
|
|
|
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);
|
|
}
|
|
|
|
defineExpose({
|
|
compName,
|
|
});
|
|
</script>
|