Files
chazhi_admin_broker/public/h5/assets/wd-swiper.CwC-Igp9.js
2026-03-11 18:24:59 +08:00

2 lines
7.1 KiB
JavaScript

var he=Object.defineProperty,ye=Object.defineProperties;var fe=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var G=(p,r,s)=>r in p?he(p,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):p[r]=s,M=(p,r)=>{for(var s in r||(r={}))ge.call(r,s)&&G(p,s,r[s]);if(O)for(var s of O(r))we.call(r,s)&&G(p,s,r[s]);return p},K=(p,r)=>ye(p,fe(r));import{aJ as l,aI as w,a5 as v,a6 as R,d as X,p as N,j as d,c as y,af as C,l as Y,w as b,k as B,s as V,aa as I,F as T,q as Z,m as x,t as H,x as ee,aM as z,r as A,aL as Ce,be as $e,W as ke,T as Pe,bf as P,bg as Ie,u as h,a7 as S,bh as be,b1 as Ve,b2 as _e,n as Se,aq as Ne,at as J,bi as Q,b4 as Te}from"./index-B-O76M86.js";const je=K(M({},R),{current:w(0),direction:l("horizontal"),minShowNum:w(2),indicatorPosition:l("bottom"),showControls:v(!1),total:w(0),type:l("dots")}),Me=X({__name:"wd-swiper-nav",props:je,emits:["change"],setup(p,{emit:r}){const s=r;function f(a){s("change",{dir:a,source:"nav"})}return(a,n)=>{const m=Y;return d(),N(T,null,[a.showControls?(d(),y(m,{key:0,class:"wd-swiper-nav__btn"},{default:b(()=>[B(m,{class:"wd-swiper-nav__btn--prev",onClick:n[0]||(n[0]=$=>f("prev"))}),B(m,{class:"wd-swiper-nav__btn--next",onClick:n[1]||(n[1]=$=>f("next"))})]),_:1})):C("",!0),a.total>=a.minShowNum?(d(),y(m,{key:1,style:I(a.customStyle),class:V(`wd-swiper-nav wd-swiper-nav--${a.direction} wd-swiper-nav--${a.type} wd-swiper-nav--${a.indicatorPosition} ${a.customClass}`)},{default:b(()=>[a.type==="dots"||a.type==="dots-bar"?(d(!0),N(T,{key:0},Z(a.total,($,_)=>(d(),y(m,{key:_,class:V(`wd-swiper-nav__item--${a.type} ${a.current===_?"is-active":""} is-${a.direction}`)},null,8,["class"]))),128)):C("",!0),a.type==="fraction"?(d(),N(T,{key:1},[x(H(a.current+1)+"/"+H(a.total),1)],64)):C("",!0)]),_:1},8,["style","class"])):C("",!0)],64)}}}),Ke=ee(Me,[["__scopeId","data-v-30cb510a"]]),Ae=K(M({},R),{autoplay:v(!0),current:w(0),direction:l("horizontal"),displayMultipleItems:w(1),duration:w(300),easingFunction:l("default"),height:z("192"),interval:w(5e3),list:{type:Array,default:()=>[]},loop:v(!0),videoLoop:v(!0),muted:v(!0),nextMargin:z("0"),indicatorPosition:l("bottom"),previousMargin:z("0"),snapToEdge:v(!1),indicator:{type:[Boolean,Object],default:!0},imageMode:l("aspectFill"),valueKey:l("value"),textKey:l("text"),autoplayVideo:v(!0),stopPreviousVideo:v(!0),stopAutoplayWhenVideoPlay:v(!1),adjustHeight:l("highest"),adjustVerticalHeight:v(!1),customIndicatorClass:l(""),customImageClass:l(""),customPrevImageClass:l(""),customNextImageClass:l(""),customItemClass:l(""),customPrevClass:l(""),customNextClass:l(""),customTextClass:l(""),customTextStyle:l("")}),Fe={name:"wd-swiper",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}},Ue=X(K(M({},Fe),{props:Ae,emits:["click","change","animationfinish","update:current"],setup(p,{emit:r}){const s=p,f=r,a=A(s.current),n=A(s.current),m=(e,t=!1)=>{n.value=e,t&&(a.value=e),f("update:current",e)},$=A(!1),{proxy:_}=Ce(),F=A($e());ke(()=>s.current,e=>{e<0?s.loop?L():E():e>=s.list.length?s.loop?E():L():j(e)});const g=Pe(()=>{const{list:e,direction:t,indicatorPosition:o,indicator:i}=s,u={current:n.value||0,total:e.length||0,direction:t||"horizontal",indicatorPosition:o||"bottom"};return P(i)&&(u.type=i.type||"dots",u.minShowNum=i.minShowNum||2,u.showControls=i.showControls||!1),u}),te=(e,t)=>{const o=i=>Te(i);return P(e)?e.type&&["video","image"].includes(e.type)?e.type===t:o(e[s.valueKey]):o(e)},U=e=>te(e,"video");function j(e){e!==n.value&&m(e,!0)}function E(){j(0)}function L(){j(s.list.length-1)}function se(){s.stopAutoplayWhenVideoPlay&&($.value=!0)}function W(){$.value=!1}function oe(e,t,o){return(e-1+o.length)%o.length===t}function ae(e,t,o){return(e+1+o.length)%o.length===t}function q(e,t,o){let i="";return oe(e,t,o)&&(i=s.customPrevClass||s.customPrevImageClass),ae(e,t,o)&&(i=s.customNextClass||s.customNextImageClass),i}function ne(e){const{current:t,source:o}=e.detail,i=n.value;f("change",{current:t,source:o}),t!==n.value&&m(t,o==="autoplay"||o==="touch"),ie(i,t)}function ie(e,t){re(e),le(t)}function le(e){if(s.autoplayVideo){const t=s.list[e];J(t)&&U(t)&&Q(`video-${e}-${F.value}`,_).play()}}function re(e){if(s.stopPreviousVideo){const t=s.list[e];J(t)&&U(t)&&Q(`video-${e}-${F.value}`,_).pause()}else s.stopAutoplayWhenVideoPlay&&W()}function ue(e){const{current:t,source:o}=e.detail;t!==n.value&&m(t,o==="autoplay"||o==="touch"),f("animationfinish",{current:t,source:o})}function D(e,t){f("click",{index:e,item:t})}function ce({dir:e}){const{list:t,loop:o}=s,i=t.length;let u=e==="next"?n.value+1:n.value-1;o?u=e==="next"?(n.value+1)%i:(n.value-1+i)%i:u=u<0||u>=i?n.value:u,u!==n.value&&j(u)}return(e,t)=>{const o=Ve,i=_e,u=Se,de=be,pe=Ie,ve=Y;return d(),y(ve,{class:V(`wd-swiper ${e.customClass}`),style:I(e.customStyle)},{default:b(()=>[B(pe,{"adjust-height":e.adjustHeight,"adjust-vertical-height":e.adjustVerticalHeight,class:"wd-swiper__track",autoplay:e.autoplay&&!$.value,current:a.value,interval:e.interval,duration:e.duration,circular:e.loop,vertical:e.direction=="vertical","easing-function":e.easingFunction,"previous-margin":h(S)(e.previousMargin),"next-margin":h(S)(e.nextMargin),"snap-to-edge":e.snapToEdge,"display-multiple-items":e.displayMultipleItems,style:I({height:h(S)(e.height)}),onChange:ne,onAnimationfinish:ue},{default:b(()=>[(d(!0),N(T,null,Z(e.list,(c,k)=>(d(),y(de,{key:k,class:"wd-swiper__item"},{default:b(()=>[U(c)?(d(),y(o,{key:0,id:`video-${k}-${F.value}`,style:I({height:h(S)(e.height)}),src:h(P)(c)?c[e.valueKey]:c,poster:h(P)(c)?c.poster:"",class:V(`wd-swiper__video ${e.customItemClass} ${q(n.value,k,e.list)}`),onPlay:se,onPause:W,"enable-progress-gesture":!1,loop:e.videoLoop,muted:e.muted,autoplay:e.autoplayVideo,objectFit:"cover",onClick:me=>D(k,c)},null,8,["id","style","src","poster","class","loop","muted","autoplay","onClick"])):(d(),y(i,{key:1,src:h(P)(c)?c[e.valueKey]:c,class:V(`wd-swiper__image ${e.customImageClass} ${e.customItemClass} ${q(n.value,k,e.list)}`),style:I({height:h(S)(e.height)}),mode:e.imageMode,onClick:me=>D(k,c)},null,8,["src","class","style","mode","onClick"])),h(P)(c)&&c[e.textKey]?(d(),y(u,{key:2,class:V(`wd-swiper__text ${e.customTextClass}`),style:I(e.customTextStyle)},{default:b(()=>[x(H(c[e.textKey]),1)]),_:2},1032,["class","style"])):C("",!0)]),_:2},1024))),128))]),_:1},8,["adjust-height","adjust-vertical-height","autoplay","current","interval","duration","circular","vertical","easing-function","previous-margin","next-margin","snap-to-edge","display-multiple-items","style"]),e.indicator?(d(),N(T,{key:0},[Ne(e.$slots,"indicator",{current:n.value,total:e.list.length},void 0,!0),e.$slots.indicator?C("",!0):(d(),y(Ke,{key:0,"custom-class":e.customIndicatorClass,type:g.value.type,current:g.value.current,total:g.value.total,direction:g.value.direction,"indicator-position":g.value.indicatorPosition,"min-show-num":g.value.minShowNum,"show-controls":g.value.showControls,onChange:ce},null,8,["custom-class","type","current","total","direction","indicator-position","min-show-num","show-controls"]))],64)):C("",!0)]),_:3},8,["class","style"])}}})),He=ee(Ue,[["__scopeId","data-v-3e5c0fb1"]]);export{He as _};