1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-16 23:30:27 +05:30
Piped/src/components/ContentItem.vue

39 lines
827 B
Vue
Raw Normal View History

<template>
2022-11-01 17:42:54 +05:30
<component :is="compName" :item="item" />
</template>
2022-11-01 17:42:54 +05:30
<script setup>
import { defineAsyncComponent } from "vue";
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 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 17:42:54 +05:30
defineExpose({
compName,
});
</script>