mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-10 10:18:23 +00:00
36 lines
780 B
Vue
36 lines
780 B
Vue
<template>
|
|
<component :is="compName" :item="item" />
|
|
</template>
|
|
|
|
<script setup>
|
|
import { defineAsyncComponent } from "vue";
|
|
|
|
const props = defineProps({
|
|
item: Object,
|
|
});
|
|
|
|
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>
|