import{_ as e,af as i,p as t,w as s,i as d,o as a,f as n,e as o,y as h,F as l,J as v,ag as c,I as r}from"./index-2PZN6pGH.js";const u=[{src:"https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hellouniapp/hello-nvue-swiper-vertical-01.mp4"},{src:"https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hellouniapp/hello-nvue-swiper-vertical-02.mp4"},{src:"https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hellouniapp/hello-nvue-swiper-vertical-03.mp4"},{src:"https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hellouniapp/hello-nvue-swiper-vertical-01.mp4"},{src:"https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hellouniapp/hello-nvue-swiper-vertical-02.mp4"},{src:"https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hellouniapp/hello-nvue-swiper-vertical-03.mp4"}];const p=e({data:()=>({circular:!0,videoList:[{id:"video0",src:"",img:""},{id:"video1",src:"",img:""},{id:"video2",src:"",img:""}],videoDataList:[]}),onLoad(e){},onReady(){this.init(),this.getData()},methods:{init(){this._videoIndex=0,this._videoContextList=[];for(var e=0;e<this.videoList.length;e++)this._videoContextList.push(i("video"+e,this));this._videoDataIndex=0},getData(e){this.videoDataList=u,setTimeout((()=>{this.updateVideo(!0)}),200)},onSwiperChange(e){let i=e.detail.current;if(i===this._videoIndex)return;let t=!1;0===i&&this._videoIndex===this.videoList.length-1?t=!0:i===this.videoList.length-1&&0===this._videoIndex?t=!1:i>this._videoIndex&&(t=!0),t?this._videoDataIndex++:this._videoDataIndex--,this._videoDataIndex<0?this._videoDataIndex=this.videoDataList.length-1:this._videoDataIndex>=this.videoDataList.length&&(this._videoDataIndex=0),this.circular=0!=this._videoDataIndex,this._videoIndex>=0&&(this._videoContextList[this._videoIndex].pause(),this._videoContextList[this._videoIndex].seek(0)),this._videoIndex=i,setTimeout((()=>{this.updateVideo(t)}),200)},getNextIndex(e){let i=this._videoIndex+(e?1:-1);return i<0?this.videoList.length-1:i>=this.videoList.length?0:i},getNextDataIndex(e){let i=this._videoDataIndex+(e?1:-1);return i<0?this.videoDataList.length-1:i>=this.videoDataList.length?0:i},updateVideo(e){this.$set(this.videoList[this._videoIndex],"src",this.videoDataList[this._videoDataIndex].src),this.$set(this.videoList[this.getNextIndex(e)],"src",this.videoDataList[this.getNextDataIndex(e)].src),setTimeout((()=>{this._videoContextList[this._videoIndex].play()}),200),console.log("v:"+this._videoIndex+" d:"+this._videoDataIndex+"; next v:"+this.getNextIndex(e)+" next d:"+this.getNextDataIndex(e))}}},[["render",function(e,i,u,p,x,g){const _=c,I=r,D=v,L=d;return a(),t(L,{class:"page"},{default:s((()=>[n(D,{class:"swiper",circular:x.circular,vertical:!0,onChange:g.onSwiperChange},{default:s((()=>[(a(!0),o(l,null,h(x.videoList,(e=>(a(),t(I,{key:e.id},{default:s((()=>[n(_,{class:"video",id:e.id,ref_for:!0,ref:e.id,src:e.src,controls:!1,loop:!0,"show-center-play-btn":!1},null,8,["id","src"])])),_:2},1024)))),128))])),_:1},8,["circular","onChange"])])),_:1})}],["__scopeId","data-v-c755ef93"]]);export{p as default};
