Files
admin/www/app/components/section/layouts/LayoutVideoShowcase.vue
T

47 lines
1.6 KiB
Vue
Raw Normal View History

2026-07-31 19:02:00 +08:00
<script setup lang="ts">
import type { SectionBlock } from '~/types/site';
const props = defineProps<{ section: SectionBlock }>();
2026-08-03 19:09:03 +08:00
const { overline, title, subtitle, isDark, overlineStyle, titleStyle, bodyStyle } = useSectionContent(props.section);
2026-07-31 19:02:00 +08:00
// 判断是否为可嵌入的 iframe 视频(YouTube / Bilibili
const isEmbed = computed(() => /youtube\.com|youtu\.be|bilibili\.com|player\.bilibili\.com/.test(props.section.video_url));
</script>
<template>
<div class="section-container py-96px">
<!-- 标题区 -->
<div class="text-center max-w-640px mx-auto mb-48px">
2026-08-04 19:18:35 +08:00
<p v-if="overline" class="text-14px font-semibold tracking-widest uppercase" :class="isDark ? 'text-primary-300' : 'text-primary'" :style="overlineStyle">
2026-07-31 19:02:00 +08:00
{{ overline }}
</p>
2026-08-03 19:09:03 +08:00
<h2 class="mt-12px text-3xl md:text-4xl font-bold" :class="isDark ? 'text-white' : 'text-gray-900 dark:text-white'" :style="titleStyle">
2026-07-31 19:02:00 +08:00
{{ title }}
</h2>
2026-08-03 19:09:03 +08:00
<p v-if="subtitle" class="mt-16px text-base" :class="isDark ? 'text-gray-400' : 'text-gray-500 dark:text-gray-400'" :style="bodyStyle">
2026-07-31 19:02:00 +08:00
{{ subtitle }}
</p>
</div>
<!-- 视频 -->
<div class="max-w-960px mx-auto rounded-16px overflow-hidden shadow-xl bg-black aspect-16/9">
<iframe
v-if="isEmbed"
:src="section.video_url"
class="w-full h-full"
frameborder="0"
allowfullscreen
scrolling="no"
/>
<video
v-else-if="section.video_url"
:src="section.video_url"
class="w-full h-full object-cover"
controls
playsinline
/>
</div>
</div>
</template>