Files
anmo/server/public/mobile/assets/u-swiper.699073b8.js
2025-08-19 14:16:51 +08:00

2 lines
4.3 KiB
JavaScript

import{o as t,e,w as i,f as r,n as o,q as a,F as n,v as s,R as u,X as l,g as d,t as c,i as m,a4 as f,j as p,S as g,y}from"./index-de4504bf.js";import{_ as h}from"./_plugin-vue_export-helper.1b428a4d.js";const b=h({name:"u-swiper",emits:["click","change"],props:{list:{type:Array,default:()=>[]},title:{type:Boolean,default:!1},indicator:{type:Object,default:()=>({})},borderRadius:{type:[Number,String],default:8},interval:{type:[String,Number],default:3e3},mode:{type:String,default:"round"},height:{type:[Number,String],default:250},indicatorPos:{type:String,default:"bottomCenter"},effect3d:{type:Boolean,default:!1},effect3dPreviousMargin:{type:[Number,String],default:50},autoplay:{type:Boolean,default:!0},duration:{type:[Number,String],default:500},circular:{type:Boolean,default:!0},imgMode:{type:String,default:"aspectFill"},name:{type:String,default:"image"},bgColor:{type:String,default:"#f3f4f6"},current:{type:[Number,String],default:0},titleStyle:{type:Object,default:()=>({})}},watch:{list(t,e){t.length!==e.length&&(this.uCurrent=0)},current(t){this.uCurrent=t}},data(){return{uCurrent:this.current}},computed:{justifyContent(){return"topLeft"==this.indicatorPos||"bottomLeft"==this.indicatorPos?"flex-start":"topCenter"==this.indicatorPos||"bottomCenter"==this.indicatorPos?"center":"topRight"==this.indicatorPos||"bottomRight"==this.indicatorPos?"flex-end":void 0},titlePaddingBottom(){let t=0;return"none"==this.mode?"12rpx":(t=["bottomLeft","bottomCenter","bottomRight"].indexOf(this.indicatorPos)>=0&&"number"==this.mode?"60rpx":["bottomLeft","bottomCenter","bottomRight"].indexOf(this.indicatorPos)>=0&&"number"!=this.mode?"40rpx":"12rpx",t)},elCurrent(){return Number(this.current)}},methods:{listClick(t){this.$emit("click",t)},change(t){let e=t.detail.current;this.uCurrent=e,this.$emit("change",e)},animationfinish(t){}}},[["render",function(h,b,C,x,P,v){const k=f,S=p,_=g,R=y;return t(),e(S,{class:"u-swiper-wrap",style:o({borderRadius:`${C.borderRadius}rpx`})},{default:i(()=>[r(R,{current:v.elCurrent,onChange:v.change,onAnimationfinish:v.animationfinish,interval:C.interval,circular:C.circular,duration:C.duration,autoplay:C.autoplay,"previous-margin":C.effect3d?C.effect3dPreviousMargin+"rpx":"0","next-margin":C.effect3d?C.effect3dPreviousMargin+"rpx":"0",style:o({height:C.height+"rpx",backgroundColor:C.bgColor})},{default:i(()=>[(t(!0),a(n,null,s(C.list,(a,n)=>(t(),e(_,{class:"u-swiper-item",key:n},{default:i(()=>[r(S,{class:u(["u-list-image-wrap",[P.uCurrent!=n?"u-list-scale":""]]),onClick:l(t=>v.listClick(n),["stop","prevent"]),style:o({borderRadius:`${C.borderRadius}rpx`,transform:C.effect3d&&P.uCurrent!=n?"scaleY(0.9)":"scaleY(1)",margin:C.effect3d&&P.uCurrent!=n?"0 20rpx":0})},{default:i(()=>[r(k,{class:"u-swiper-image",src:a[C.name]||a,mode:C.imgMode},null,8,["src","mode"]),C.title&&a.title?(t(),e(S,{key:0,class:"u-swiper-title u-line-1",style:o([{"padding-bottom":v.titlePaddingBottom},C.titleStyle])},{default:i(()=>[d(c(a.title),1)]),_:2},1032,["style"])):m("",!0)]),_:2},1032,["onClick","class","style"])]),_:2},1024))),128))]),_:1},8,["current","onChange","onAnimationfinish","interval","circular","duration","autoplay","previous-margin","next-margin","style"]),r(S,{class:"u-swiper-indicator",style:o({top:"topLeft"==C.indicatorPos||"topCenter"==C.indicatorPos||"topRight"==C.indicatorPos?"12rpx":"auto",bottom:"bottomLeft"==C.indicatorPos||"bottomCenter"==C.indicatorPos||"bottomRight"==C.indicatorPos?"12rpx":"auto",justifyContent:v.justifyContent,padding:"0 "+(C.effect3d?"74rpx":"24rpx")})},{default:i(()=>["rect"==C.mode?(t(!0),a(n,{key:0},s(C.list,(i,r)=>(t(),e(S,{class:u(["u-indicator-item-rect",{"u-indicator-item-rect-active":r==P.uCurrent}]),key:r},null,8,["class"]))),128)):m("",!0),"dot"==C.mode?(t(!0),a(n,{key:1},s(C.list,(i,r)=>(t(),e(S,{class:u(["u-indicator-item-dot",{"u-indicator-item-dot-active":r==P.uCurrent}]),key:r},null,8,["class"]))),128)):m("",!0),"round"==C.mode?(t(!0),a(n,{key:2},s(C.list,(i,r)=>(t(),e(S,{class:u(["u-indicator-item-round",{"u-indicator-item-round-active":r==P.uCurrent}]),key:r},null,8,["class"]))),128)):m("",!0),"number"==C.mode?(t(),e(S,{key:3,class:"u-indicator-item-number"},{default:i(()=>[d(c(P.uCurrent+1)+"/"+c(C.list.length),1)]),_:1})):m("",!0)]),_:1},8,["style"])]),_:1},8,["style"])}],["__scopeId","data-v-90956b03"]]);export{b as _};