2 lines
2.6 KiB
JavaScript
2 lines
2.6 KiB
JavaScript
|
"use strict";const e=require("../../../common/vendor.js"),t=require("../../index.js");if(!Array){e.resolveComponent("su-video")()}Math;const i={__name:"su-swiper",props:{circular:{type:Boolean,default:!0},autoplay:{type:Boolean,default:!1},interval:{type:Number,default:3e3},duration:{type:Number,default:500},mode:{type:String,default:"default"},imageMode:{type:String,default:"scaleToFill"},list:{type:Array,default:()=>[]},dotStyle:{type:String,default:"long"},dotCur:{type:String,default:"ss-bg-opactity-block"},bg:{type:String,default:"bg-none"},height:{type:Number,default:0},imgHeight:{type:Number,default:0},imgTopRadius:{type:Number,default:0},imgBottomRadius:{type:Number,default:0},isPreview:{type:Boolean,default:!1},seizeHeight:{type:Number,default:200}},setup(i){const r=e.reactive({imgHeight:0,cur:0,moveX:0,videoPlaySataus:!1,heightList:[]}),o=e.reactive({videoRef:{}}),a=i,u=e=>{"touch"!==e.detail.source&&"autoplay"!==e.detail.source||(r.cur=e.detail.current,r.videoPlaySataus=!1,"video"===a.list[r.cur].type&&o.videoRef[`video_${r.cur}`].pausePlay())},d=()=>{if(!a.isPreview)return;const t=e.clone(a.list);t.forEach(((e,i)=>{"video"===e.type&&t.splice(i,1)})),e.index.previewImage({urls:t.length<1?[a.src]:t.reduce(((e,t)=>(e.push(t.src),e)),[]),current:r.cur})},l=e=>{},s=e=>{r.moveX=0},n=e=>{a.list[r.cur].currentTime=e.detail.currentTime},c=e.computed((()=>{let e;return 0!==a.height&&(e=a.height),0===a.height&&(0!==r.imgHeight?e=r.imgHeight:0!==a.seizeHeight&&(e=a.seizeHeight)),{height:e+"rpx"}}));function g(e){if(0===a.height){const t=e.detail.height/e.detail.width*750;r.imgHeight<t&&(r.imgHeight=t)}}return(p,y)=>e.e({a:e.f(a.list,((u,l,s)=>e.e({a:"image"===u.type},"image"===u.type?{b:a.imageMode,c:u.src,d:e.o(g,l)}:{e:e.sr((e=>o.videoRef[`video_${l}`]=e),"55f7d62d-0-"+s,{f:1}),f:e=>o.videoRef[`video_${l}`]=e,g:e.o(n,l),h:"55f7d62d-0-"+s,i:e.p({poster:e.unref(t.sheep).$url.cdn(u.poster),src:e.unref(t.sheep).$url.cdn(u.src),index:l,moveX:r.moveX,initialTime:u.currentTime||0,height:i.seizeHeight})},{j:l,k:r.cur==l?1:"",l:e.o((e=>(e=>{"video"===e.type?r.videoPlaySataus=!0:(t.sheep.$router.go(e.url),d())})(u)),l)}))),b:a.circular,c:r.cur,d:a.autoplay&&!r.videoPlaySataus,e:a.interval,f:a.duration,g:e.o(l),h:e.o(s),i:e.s(c.value),j:e.o(u),k:!r.videoPlaySataus},r.videoPlaySataus?{}:e.e({l:"tag"!=a.dotStyle},"tag"!=a.dotStyle?{m:e.f(a.list,((t,i,o)=>({a:i,b:e.n(r.cur==i?"cur":"")}))),n:e.n(a.dotCur),o:e.n(a.dotStyle)}:{},{p:"tag"==a.dotStyle},"tag"==a.dotStyle?{q:e.t(r.cur+1),r:e.t(a.list.length),s:e.n(a.dotCur),t:e.n(a.dotStyle)}:{}),{v:e.n(a.mode),w:e.n(a.bg),x:e.n(a.ui)})}},r=e._export_sfc(i,[["__scopeId","data-v-55f7d62d"]]);wx.createComponent(r);
|