更新记录
0.0.1(2025-06-27)
下载此版本
第一次 relase
平台兼容性
uni-app(4.03)
Vue2 |
Vue3 |
Vue2插件版本 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
- |
√ |
0.0.1 |
- |
√ |
√ |
√ |
√ |
√ |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x(4.03)
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
- |
- |
- |
- |
其他
vue3-video-swiper
Vue3 视频图片轮播组件, 支持 H5, App, 小程序
工作原理
- 通过 VideoMask 组件覆盖在 swiper 容器上实现视频播放功能
- 监听 touch 事件来处理左右滑动切换,实现类似原生 swiper 的交互效果
使用方法
{
"pages": [
{
"path": "pages/home",
"style": {
"navigationStyle": "custom",
"app-plus": {
"subNVues": [{
"id": "videoMask",
"path": "components/vue3-video-swiper/subnvue/vue3-video-mask",
"style": {
"position": "absolute",
"background": "transparent"
}
}]
},
"enablePullDownRefresh": false
}
},
// ...
}
<script setup lang="ts">
import VideoSwiper from '@/components/vue3-video-swiper/vue3-video-swiper.vue'
const banners = [
{ id: 1, url: 'xxx', isVideo: true, }
{ id: 2, url: 'xxx', isVideo: false, }
]
</script>
<template>
<VideoSwiper
v-else
:list="banners"
:height="bannerHeight"
class="w-full h-full"
/>
</template>
Component Props
属性名 |
类型 |
默认值 |
必填 |
说明 |
height |
Number |
0 |
是 |
轮播容器高度(像素) |
radius |
Number |
0 |
否 |
圆角半径(像素) |
list |
Array |
[] |
是 |
轮播数据列表,每个项目包含 url (资源地址)和 isVideo (是否为视频)属性 |
list 数据结构
interface ListItem {
id?: number | string // 项目ID(可选)
url: string // 资源地址(图片或视频URL)
isVideo: boolean // 是否为视频文件
}
Component Events
事件名 |
参数 |
说明 |
itemClick |
position: number |
点击广告/轮播项时触发,返回当前点击的项目索引 |
数据格式示例
const bannerList = [
{
id: 1,
url: 'https://example.com/video.mp4',
isVideo: true,
},
{
id: 2,
url: 'https://example.com/image.jpg',
isVideo: false,
},
{
id: 3,
url: 'https://example.com/another-video.mp4',
isVideo: true,
},
]