多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4 KiB

2 months ago
<script setup lang="ts">
import Plyr from 'plyr'
import 'plyr/dist/plyr.css'
import type { ProductFeedItem } from '../../../lib/types'
2 months ago
const props = defineProps<{
item: ProductFeedItem
2 months ago
}>()
const {
item: { Title, Description, Url },
} = props
2 months ago
const videoPlayer = ref<HTMLElement>()
const player = ref()
onMounted(() => {
if (!videoPlayer.value) return
player.value = new Plyr(videoPlayer.value, {
previewThumbnails: {},
quality: {
default: 1080,
options: [720, 1080, 2160],
},
2 months ago
})
})
onBeforeUnmount(() => {
if (player.value) {
player.value.destroy()
}
})
</script>
<template>
<div class="flex flex-col mt-6 gap-5">
2 months ago
<div class="aspect-video !rounded-lg mx-auto !h-[428px]">
<div id="player" ref="videoPlayer" class="plyr__video-embed">
<iframe
:src="`${Url}?origin=https://plyr.io&amp;iv_load_policy=3&amp;modestbranding=1&amp;playsinline=1&amp;showinfo=0&amp;rel=0&amp;enablejsapi=1`"
2 months ago
allowfullscreen
allowtransparency
allow="autoplay"
></iframe>
</div>
</div>
<div class="text-gray-900 font-bold text-2xl">
{{ Title }}
2 months ago
</div>
<div class="text-gray-900">
{{ Description.length > 200 ? `${Description.slice(0, 280)}...` : Description }}
</div>
2 months ago
</div>
</template>
<style lang="scss">
.plyr--video {
@apply !rounded-lg;
}
</style>