wot-design-uni/demo/assets/subPages-swiper-Index.BPxRpvnL.js

2 lines
13 KiB
JavaScript

var t=Object.defineProperty,e=Object.defineProperties,a=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(e,a,i)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i,n=(t,e)=>{for(var a in e||(e={}))s.call(e,a)&&l(t,a,e[a]);if(i)for(var a of i(e))o.call(e,a)&&l(t,a,e[a]);return t},u=(t,i)=>e(t,a(i));import{d as r,m as c,g as p,b as d,z as m,i as g,w as h,h as v,q as y,E as f,F as w,n as _,j as C,t as b,a5 as x,r as k,J as $,Y as j,C as P,c as I,O as z,b3 as V,l as M,H as U,b4 as O,D as S,aW as N,p as q,k as K,B as A,b5 as F,aX as H,u as T,e as D,f as W}from"./index-ChV97F5w.js";import{b as E,a as B,m as L,c as G,_ as J,d as X}from"./base64.D3gEw_Hf.js";import{_ as Y}from"./demo-block.bo7yY1Pq.js";import{a as Q,p as R,d as Z,_ as tt}from"./page-wraper.D9WpzC1k.js";import{_ as et}from"./wd-cell-group.C1j5zmf1.js";import{_ as at}from"./wd-button.DXEkLyH0.js";import"./wd-root-portal.BUSGVytV.js";import"./useChildren.C_02WC2s.js";const it=J(r({__name:"wd-swiper-nav",props:u(n({},E),{current:L(0),direction:B("horizontal"),minShowNum:L(2),indicatorPosition:B("bottom"),showControls:G(!1),total:L(0),type:B("dots")}),emits:["change"],setup(t,{emit:e}){const a=e;function i(t){a("change",{dir:t,source:"nav"})}return(t,e)=>{const a=g;return p(),c(w,null,[t.showControls?(p(),d(a,{key:0,class:"wd-swiper-nav__btn"},{default:h((()=>[v(a,{class:"wd-swiper-nav__btn--prev",onClick:e[0]||(e[0]=t=>i("prev"))}),v(a,{class:"wd-swiper-nav__btn--next",onClick:e[1]||(e[1]=t=>i("next"))})])),_:1})):m("",!0),t.total>=t.minShowNum?(p(),d(a,{key:1,style:f(t.customStyle),class:y(`wd-swiper-nav wd-swiper-nav--${t.direction} wd-swiper-nav--${t.type} wd-swiper-nav--${t.indicatorPosition} ${t.customClass}`)},{default:h((()=>["dots"===t.type||"dots-bar"===t.type?(p(!0),c(w,{key:0},_(t.total,((e,i)=>(p(),d(a,{key:i,class:y(`wd-swiper-nav__item--${t.type} ${t.current===i?"is-active":""} is-${t.direction}`)},null,8,["class"])))),128)):m("",!0),"fraction"===t.type?(p(),c(w,{key:1},[C(b(t.current+1)+"/"+b(t.total),1)],64)):m("",!0)])),_:1},8,["style","class"])):m("",!0)],64)}}}),[["__scopeId","data-v-3a6b4a1d"]]),st=u(n({},E),{autoplay:G(!0),current:L(0),direction:B("horizontal"),displayMultipleItems:L(1),duration:L(300),easingFunction:B("default"),height:X("192"),interval:L(5e3),list:{type:Array,default:()=>[]},loop:G(!0),videoLoop:G(!0),muted:G(!0),nextMargin:X("0"),indicatorPosition:B("bottom"),previousMargin:X("0"),snapToEdge:G(!1),indicator:{type:[Boolean,Object],default:!0},imageMode:B("aspectFill"),valueKey:B("value"),textKey:B("text"),autoplayVideo:G(!0),stopPreviousVideo:G(!0),stopAutoplayWhenVideoPlay:G(!1),adjustHeight:B("highest"),adjustVerticalHeight:G(!1),customIndicatorClass:B(""),customImageClass:B(""),customPrevImageClass:B(""),customNextImageClass:B(""),customItemClass:B(""),customPrevClass:B(""),customNextClass:B(""),customTextClass:B(""),customTextStyle:B("")}),ot=J(r(u(n({},{name:"wd-swiper",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}}),{props:st,emits:["click","change","animationfinish","update:current"],setup(t,{emit:e}){const a=x(),i=t,s=e,o=k(i.current),l=k(i.current),n=(t,e=!1)=>{l.value=t,e&&(o.value=t),s("update:current",t)},u=k(!1),{proxy:r}=$(),T=k(j());P((()=>i.current),(t=>{t<0?i.loop?G():L():t>=i.list.length?i.loop?L():G():B(t)}));const D=I((()=>"wd-swiper__item "+(a.default?"wd-swiper__item--slot":""))),W=I((()=>{const{list:t,direction:e,indicatorPosition:a,indicator:s}=i,o={current:l.value||0,total:t.length||0,direction:e||"horizontal",indicatorPosition:a||"bottom"};return z(s)&&(o.type=s.type||"dots",o.minShowNum=s.minShowNum||2,o.showControls=s.showControls||!1),o})),E=t=>((t,e)=>{const a=t=>H(t);return z(t)?t.type&&["video","image"].includes(t.type)?t.type===e:a(t[i.valueKey]):a(t)})(t,"video");function B(t){t!==l.value&&n(t,!0)}function L(){B(0)}function G(){B(i.list.length-1)}function J(){i.stopAutoplayWhenVideoPlay&&(u.value=!0)}function X(){u.value=!1}function Y(t,e,a){let s="";return function(t,e,a){return(t-1+a.length)%a.length===e}(t,e,a)&&(s=i.customPrevClass||i.customPrevImageClass),function(t,e,a){return(t+1+a.length)%a.length===e}(t,e,a)&&(s=i.customNextClass||i.customNextImageClass),s}function Q(t){const{current:e,source:a}=t.detail,o=l.value;if(s("change",{current:e,source:a}),e!==l.value){n(e,"autoplay"===a||"touch"===a)}!function(t,e){(function(t){if(i.stopPreviousVideo){const e=i.list[t];if(A(e)&&E(e)){F(`video-${t}-${T.value}`,r).pause()}}else i.stopAutoplayWhenVideoPlay&&X()})(t),function(t){if(i.autoplayVideo){const e=i.list[t];if(A(e)&&E(e)){F(`video-${t}-${T.value}`,r).play()}}}(e)}(o,e)}function R(t){const{current:e,source:a}=t.detail;if(e!==l.value){n(e,"autoplay"===a||"touch"===a)}s("animationfinish",{current:e,source:a})}function Z(t,e){s("click",{index:t,item:e})}function tt({dir:t}){const{list:e,loop:a}=i,s=e.length;let o="next"===t?l.value+1:l.value-1;o=a?"next"===t?(l.value+1)%s:(l.value-1+s)%s:o<0||o>=s?l.value:o,o!==l.value&&B(o)}return(t,e)=>{const a=N,i=q,s=K,n=O,r=V,x=g;return p(),d(x,{class:y(`wd-swiper ${t.customClass}`),style:f(t.customStyle)},{default:h((()=>[v(r,{"adjust-height":t.adjustHeight,"adjust-vertical-height":t.adjustVerticalHeight,class:"wd-swiper__track",autoplay:t.autoplay&&!u.value,current:o.value,interval:t.interval,duration:t.duration,circular:t.loop,vertical:"vertical"==t.direction,"easing-function":t.easingFunction,"previous-margin":M(U)(t.previousMargin),"next-margin":M(U)(t.nextMargin),"snap-to-edge":t.snapToEdge,"display-multiple-items":t.displayMultipleItems,style:f({height:M(U)(t.height)}),onChange:Q,onAnimationfinish:R},{default:h((()=>[(p(!0),c(w,null,_(t.list,((e,o)=>(p(),d(n,{key:o,class:y(D.value)},{default:h((()=>[S(t.$slots,"default",{item:e,index:o},(()=>[E(e)?(p(),d(a,{key:0,id:`video-${o}-${T.value}`,style:f({height:M(U)(t.height)}),src:M(z)(e)?e[t.valueKey]:e,poster:M(z)(e)?e.poster:"",class:y(`wd-swiper__video ${t.customItemClass} ${Y(l.value,o,t.list)}`),onPlay:J,onPause:X,"enable-progress-gesture":!1,loop:t.videoLoop,muted:t.muted,autoplay:t.autoplayVideo,objectFit:"cover",onClick:t=>Z(o,e)},null,8,["id","style","src","poster","class","loop","muted","autoplay","onClick"])):(p(),d(i,{key:1,src:M(z)(e)?e[t.valueKey]:e,class:y(`wd-swiper__image ${t.customImageClass} ${t.customItemClass} ${Y(l.value,o,t.list)}`),style:f({height:M(U)(t.height)}),mode:t.imageMode,onClick:t=>Z(o,e)},null,8,["src","class","style","mode","onClick"])),M(z)(e)&&e[t.textKey]?(p(),d(s,{key:2,class:y(`wd-swiper__text ${t.customTextClass}`),style:f(t.customTextStyle)},{default:h((()=>[C(b(e[t.textKey]),1)])),_:2},1032,["class","style"])):m("",!0)]),!0)])),_:2},1032,["class"])))),128))])),_:3},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"]),t.indicator?(p(),c(w,{key:0},[S(t.$slots,"indicator",{current:l.value,total:t.list.length},void 0,!0),t.$slots.indicator?m("",!0):(p(),d(it,{key:0,"custom-class":t.customIndicatorClass,type:W.value.type,current:W.value.current,total:W.value.total,direction:W.value.direction,"indicator-position":W.value.indicatorPosition,"min-show-num":W.value.minShowNum,"show-controls":W.value.showControls,onChange:tt},null,8,["custom-class","type","current","total","direction","indicator-position","min-show-num","show-controls"]))],64)):m("",!0)])),_:3},8,["class","style"])}}})),[["__scopeId","data-v-ccaddb4b"]]),lt=J(r({__name:"Index",setup(t){const{t:e}=T(),a=k(["https://wot-ui.cn/assets/redpanda.jpg","https://wot-ui.cn/assets/capybara.jpg","https://wot-ui.cn/assets/panda.jpg","https://wot-ui.cn/assets/moon.jpg","https://wot-ui.cn/assets/meng.jpg"]),i=k([{url:"https://wot-ui.cn/assets/redpanda.jpg",title:e("xiao-xiong-mao")},{url:"https://wot-ui.cn/assets/capybara.jpg",title:e("ka-pi-ba-la")},{url:"https://wot-ui.cn/assets/panda.jpg",title:e("da-xiong-mao")},{url:"https://wot-ui.cn/assets/moon.jpg",title:e("shi-hua-zhong-guo")}]),s=k(["https://unpkg.com/wot-design-uni-assets@1.0.3/VID_115503.mp4","https://unpkg.com/wot-design-uni-assets@1.0.3/VID_150752.mp4","https://unpkg.com/wot-design-uni-assets@1.0.3/VID_155516.mp4","https://wot-ui.cn/assets/moon.jpg"]),o=k(0),l=k(1),n=k(2),u=k(3),r=k(4),c=k(0),m=k(0),y=k(0),f=k(0),w=k(0),_=k(!1);function x(t){console.log(t)}function $(t){console.log(t)}return(t,e)=>{const k=D(W("wd-swiper"),ot),j=D(W("demo-block"),Y),P=g,I=D(W("wd-gap"),R),z=D(W("wd-switch"),Z),V=D(W("wd-cell"),tt),M=D(W("wd-cell-group"),et),U=D(W("wd-button"),at),O=q,S=D(W("page-wraper"),Q);return p(),d(S,null,{default:h((()=>[v(j,{title:t.$t("dian-zhuang-zhi-shi-qi")},{default:h((()=>[v(k,{list:a.value,autoplay:"",current:o.value,"onUpdate:current":e[0]||(e[0]=t=>o.value=t),indicator:{type:"dots"},onClick:x,onChange:$},null,8,["list","current"])])),_:1},8,["title"]),v(j,{title:t.$t("dian-tiao-zhuang-zhi-shi-qi")},{default:h((()=>[v(k,{list:a.value,autoplay:"",current:l.value,"onUpdate:current":e[1]||(e[1]=t=>l.value=t),indicator:{type:"dots-bar"},onClick:x,onChange:$},null,8,["list","current"])])),_:1},8,["title"]),v(j,{title:t.$t("shu-zi-zhi-shi-qi")},{default:h((()=>[v(k,{list:a.value,autoplay:"",current:n.value,"onUpdate:current":e[2]||(e[2]=t=>n.value=t),indicator:{type:"fraction"},"indicator-position":"bottom-right",onClick:x,onChange:$},null,8,["list","current"])])),_:1},8,["title"]),v(j,{title:t.$t("shi-pin-lun-bo")},{default:h((()=>[v(k,{list:s.value,autoplay:"",indicator:{type:"fraction"},"indicator-position":"top-right",onClick:x,onChange:$},null,8,["list"])])),_:1},8,["title"]),v(j,{title:t.$t("shou-dong-bo-fang-shi-pin")},{default:h((()=>[v(k,{list:s.value,autoplay:"",autoplayVideo:!1,indicator:{type:"fraction"},"indicator-position":"top-right",onClick:x,onChange:$},null,8,["list"])])),_:1},8,["title"]),v(j,{title:t.$t("bo-fang-shi-pin-shi-ting-zhi-lun-bo")},{default:h((()=>[v(k,{list:s.value,autoplay:"",stopAutoplayWhenVideoPlay:"",autoplayVideo:!1,indicator:{type:"fraction"},"indicator-position":"top-right",onClick:x,onChange:$},null,8,["list"])])),_:1},8,["title"]),v(j,{title:t.$t("shou-dong-qie-huan")},{default:h((()=>[v(k,{list:a.value,autoplay:!1,current:u.value,"onUpdate:current":e[3]||(e[3]=t=>u.value=t),indicator:{showControls:!0},loop:!1,onClick:x,onChange:$},null,8,["list","current"])])),_:1},8,["title"]),v(j,{title:t.$t("ka-pian-yang-shi")},{default:h((()=>[v(P,{class:"card-swiper"},{default:h((()=>[v(k,{autoplay:"",current:r.value,"onUpdate:current":e[4]||(e[4]=t=>r.value=t),"custom-indicator-class":"custom-indicator-class","custom-image-class":"custom-image","custom-next-image-class":"custom-image-prev","custom-prev-image-class":"custom-image-prev",indicator:{type:"dots"},list:a.value,previousMargin:"24px",nextMargin:"24px"},null,8,["current","list"])])),_:1})])),_:1},8,["title"]),v(j,{title:t.$t("tong-shi-zhan-shi-2-ge-hua-kuai")},{default:h((()=>[v(P,{class:"card-swiper"},{default:h((()=>[v(k,{autoplay:"",current:c.value,"onUpdate:current":e[5]||(e[5]=t=>c.value=t),"display-multiple-items":2,"custom-indicator-class":"custom-indicator-class","custom-image-class":"custom-image","custom-next-image-class":"custom-image-prev","custom-prev-image-class":"custom-image-prev",indicator:{type:"dots"},list:a.value,previousMargin:"24px",nextMargin:"24px"},null,8,["current","list"])])),_:1})])),_:1},8,["title"]),v(j,{title:t.$t("chui-zhi-fang-xiang")},{default:h((()=>[v(k,{list:a.value,direction:"vertical","indicator-position":"right",autoplay:"",current:m.value,"onUpdate:current":e[6]||(e[6]=t=>m.value=t),indicator:{type:"dots-bar"},onClick:x,onChange:$},null,8,["list","current"])])),_:1},8,["title"]),v(j,{title:t.$t("zi-ding-yi-zhi-shi-qi")},{default:h((()=>[v(k,{list:a.value,direction:"vertical","indicator-position":"right",autoplay:"",current:y.value,"onUpdate:current":e[7]||(e[7]=t=>y.value=t),onClick:x,onChange:$},{indicator:h((({current:t,total:e})=>[v(P,{class:"custom-indicator",style:{position:"absolute",bottom:"24rpx",right:"24rpx"}},{default:h((()=>[C(b(t+1)+"/"+b(e),1)])),_:2},1024)])),_:1},8,["list","current"])])),_:1},8,["title"]),v(j,{title:t.$t("zhi-ding-valuekey-he-textkey")},{default:h((()=>[v(k,{"value-key":"url","text-key":"title",list:i.value,autoplay:"",current:w.value,"onUpdate:current":e[8]||(e[8]=t=>w.value=t),onClick:x,onChange:$},null,8,["list","current"])])),_:1},8,["title"]),v(j,{title:t.$t("shu-xing-kong-zhi-qie-huan")},{default:h((()=>[v(k,{loop:_.value,autoplay:!1,list:a.value,current:f.value,"onUpdate:current":e[9]||(e[9]=t=>f.value=t)},null,8,["loop","list","current"]),v(I),v(M,null,{default:h((()=>[v(V,{title:"loop"},{default:h((()=>[v(z,{modelValue:_.value,"onUpdate:modelValue":e[10]||(e[10]=t=>_.value=t),size:"24px"},null,8,["modelValue"])])),_:1}),v(V,{title:"current",value:f.value.toString()},null,8,["value"])])),_:1}),v(P,{style:{display:"flex","justify-content":"space-between"}},{default:h((()=>[v(U,{onClick:e[11]||(e[11]=t=>f.value--)},{default:h((()=>[C("prev")])),_:1}),v(U,{type:"success",onClick:e[12]||(e[12]=t=>f.value++)},{default:h((()=>[C("next")])),_:1})])),_:1})])),_:1},8,["title"]),v(j,{title:t.$t("cha-cao-yong-fa")},{default:h((()=>[v(k,{list:a.value,autoplay:"",current:l.value,"onUpdate:current":e[13]||(e[13]=t=>l.value=t),indicator:{type:"dots-bar"},onClick:x,onChange:$},{default:h((({item:t})=>[v(O,{src:t,mode:"aspectFill",style:{width:"100%",height:"100%"}},null,8,["src"])])),_:1},8,["list","current"])])),_:1},8,["title"])])),_:1})}}}),[["__scopeId","data-v-2f5bef26"]]);export{lt as default};