feat:【mall】video-player 优化
This commit is contained in:
@@ -2,23 +2,18 @@ import type { ComponentStyle, DiyComponent } from '../../../util';
|
||||
|
||||
/** 视频播放属性 */
|
||||
export interface VideoPlayerProperty {
|
||||
// 视频链接
|
||||
videoUrl: string;
|
||||
// 封面链接
|
||||
posterUrl: string;
|
||||
// 是否自动播放
|
||||
autoplay: boolean;
|
||||
// 组件样式
|
||||
style: VideoPlayerStyle;
|
||||
videoUrl: string; // 视频链接
|
||||
posterUrl: string; // 封面链接
|
||||
autoplay: boolean; // 是否自动播放
|
||||
style: VideoPlayerStyle; // 组件样式
|
||||
}
|
||||
|
||||
// 视频播放样式
|
||||
/** 视频播放样式 */
|
||||
export interface VideoPlayerStyle extends ComponentStyle {
|
||||
// 视频高度
|
||||
height: number;
|
||||
height: number; // 视频高度
|
||||
}
|
||||
|
||||
// 定义组件
|
||||
/** 定义组件 */
|
||||
export const component = {
|
||||
id: 'VideoPlayer',
|
||||
name: '视频播放',
|
||||
|
||||
@@ -11,13 +11,13 @@ defineProps<{ property: VideoPlayerProperty }>();
|
||||
<template>
|
||||
<div class="w-full" :style="{ height: `${property.style.height}px` }">
|
||||
<ElImage
|
||||
class="w-full"
|
||||
class="block h-full w-full"
|
||||
:src="property.posterUrl"
|
||||
v-if="property.posterUrl"
|
||||
/>
|
||||
<video
|
||||
v-else
|
||||
class="w-full"
|
||||
class="h-full w-full"
|
||||
:src="property.videoUrl"
|
||||
:poster="property.posterUrl"
|
||||
:autoplay="property.autoplay"
|
||||
@@ -25,12 +25,3 @@ defineProps<{ property: VideoPlayerProperty }>();
|
||||
></video>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 图片 */
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,11 +9,13 @@ import UploadImg from '#/components/upload/image-upload.vue';
|
||||
|
||||
import ComponentContainerProperty from '../../component-container-property.vue';
|
||||
|
||||
// 视频播放属性面板
|
||||
/** 视频播放属性面板 */
|
||||
defineOptions({ name: 'VideoPlayerProperty' });
|
||||
|
||||
const props = defineProps<{ modelValue: VideoPlayerProperty }>();
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const formData = useVModel(props, 'modelValue', emit);
|
||||
</script>
|
||||
|
||||
@@ -59,5 +61,3 @@ const formData = useVModel(props, 'modelValue', emit);
|
||||
</ElForm>
|
||||
</ComponentContainerProperty>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
Reference in New Issue
Block a user