视频嵌入

文档版本:1.1.0

组件名:BhtVideoEmbed

描述

视频嵌入组件,用于播放外部视频文件。

效果

视频嵌入 效果图

示例

<bht-video-embed></bht-video-embed>

代码

<bht-video-embed :ref="item.id" :item="item"></bht-video-embed>

<BhtVideoEmbed :ref="item.id" :item="item"></BhtVideoEmbed>

参数

该组件未声明外部 props。

组件配置项

key名称类型默认值说明
sourceUrl视频地址stringhttps://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4支持 mp4、webm、ogg 或外部视频文件 URL
poster封面地址string-可选,视频封面图片 URL
title标题string-可选,用于无障碍说明
height显示高度string360px例如 360px、56vw
objectFit填充方式stringcover选择视频填充方式
controls播放控制stringtrue是否显示播放控制
autoplay自动播放stringfalse浏览器通常要求同时静音
muted静音stringfalse自动播放建议开启静音
loop循环播放stringfalse是否循环播放

通用布局配置

key名称类型默认值说明
componentWidth组件宽度string100%支持 100%、320px、50vw
componentHeight组件高度string-可选,例如 360px、50vh
componentPositionMode布局模式selectflowflow、absolute、fixed
componentPositionXX 位置string-自由/固定模式,例如 120px
componentPositionYY 位置string-自由/固定模式,例如 80px
componentZIndex层级string-例如 10
componentHorizontalAlign水平对齐selectcenterleft、center、right、stretch
componentVerticalAlign垂直对齐selecttoptop、middle、bottom、stretch
componentLocked锁定位置selectfalsetrue、false
componentRelativeTo参照组件 IDselect-可选择其他已有组件的 id 和名称
componentRelativePlacement相对位置select-right、left、bottom、top
componentRelativeGap相对间距string12px例如 12px

通用样式配置

key名称类型默认值说明
componentMargin外边距string-例如 16px 或 12px 24px
componentPadding内边距string-例如 16px 或 12px 24px
componentMinWidth最小宽度string-例如 240px
componentMaxWidth最大宽度string-例如 1200px 或 none
componentMinHeight最小高度string-例如 120px
componentMaxHeight最大高度string-例如 720px 或 none
componentBackgroundColor背景颜色color-例如 #ffffff 或 rgba(255,255,255,.9)
componentBackgroundImage背景图片string-例如 url(https://...) 或 linear-gradient(...)
componentBackgroundSize背景尺寸string-例如 cover、contain、100% 100%
componentBackgroundPosition背景位置string-例如 center、left top
componentBackgroundRepeat背景重复select-no-repeat、repeat、repeat-x、repeat-y
componentBorderColor边框颜色color-请选择边框颜色
componentBorderWidth边框宽度string-例如 1px 或 1px 0 0
componentBorderStyle边框样式select-solid、dashed、dotted、none
componentBorderRadius圆角string-例如 8px 或 12px 12px 0 0
componentBoxShadow阴影string-例如 0 12px 32px rgba(15,23,42,.12)
componentOpacity透明度string-0 到 1,例如 .95
componentOverflow溢出处理select-visible、hidden、auto、clip
componentTextAlign文本对齐select-left、center、right、justify
componentColor文字颜色color-请选择文字颜色
componentBoxSizing盒模型selectborder-boxborder-box、content-box
componentFilter滤镜string-例如 blur(2px)、grayscale(1)
componentBackdropFilter背景滤镜string-例如 blur(12px)
componentCustomStyle自定义 CSStextarea-例如 transform: translateY(8px);

媒体嵌入样式配置

key名称类型默认值说明
width内容宽度string100%例如 100%、640px、80vw
minHeight最小高度string-例如 160px
margin外边距string0例如 0、16px、12px auto
padding内边距string0例如 0、16px
backgroundColor背景颜色color#ffffff例如 transparent、#ffffff
borderColor边框颜色color#d7dee8例如 transparent、#e5e7eb
borderWidth边框宽度string0例如 0、1px
borderStyle边框样式selectsolidsolid、dashed、dotted、none
borderRadius圆角string0例如 0、8px、18px
boxShadow阴影stringnone例如 none、0 18px 40px rgba(...)
opacity透明度string1例如 .85、1
overflow溢出处理selecthiddenhidden、visible、auto
mediaBackgroundColor媒体背景色color#000000播放器或 iframe 背景色
mediaBorderColor媒体边框色color#d7dee8播放器或 iframe 边框颜色
mediaBorderWidth媒体边框宽度string0例如 0、1px
mediaBorderStyle媒体边框样式selectsolidsolid、dashed、dotted、none
mediaBorderRadius媒体圆角string8px例如 8px、12px、16px
mediaBoxShadow媒体阴影stringnone例如 none、0 16px 36px rgba(...)
mediaMinHeight媒体最小高度string-例如 120px、180px
customStyle自定义样式string-例如 backdrop-filter: blur(12px);

引入

import { BhtVideoEmbed } from '@behappyto/cms-ui-vue3'