acdr-ui/dist/build/mp-weixin/modules/mall/sheep/components/s-menu-button/s-menu-button.js

2 lines
2.4 KiB
JavaScript
Raw Normal View History

2024-10-01 09:15:35 +08:00
"use strict";const e=require("../../../../../common/vendor.js"),t=require("../../index.js"),o={__name:"s-menu-button",props:{data:{type:Object,default:()=>({})},styles:{type:Object,default:()=>({})},circular:{type:Boolean,default:!0},autoplay:{type:Boolean,default:!1},interval:{type:Number,default:5e3},duration:{type:Number,default:500},ui:{type:String,default:""},mode:{type:String,default:"default"},dotStyle:{type:String,default:"long"},dotCur:{type:String,default:"ui-BG-Main"},height:{type:Number,default:300},hasBorder:{type:Boolean,default:!0},borderColor:{type:String,default:"red"},background:{type:String,default:"blue"},hoverClass:{type:String,default:"ss-hover-class"},col:{type:[Number,String],default:3},iconSize:{type:Number,default:80},color:{type:String,default:"#000"}},setup(o){const a=e.reactive({cur:0}),r=o,l=e.computed((()=>{const{bgType:e,bgImg:t,bgColor:o}=r.styles;return{background:"img"===e?`url(${t}) no-repeat top center / 100% 100%`:o}})),u=e.computed((()=>c(r.data.list,r.data.row*r.data.column))),n=e.computed((()=>r.data.row*("iconText"===r.data.layout?200:180)));t.sheep.$platform.device.windowWidth;const d=e=>{a.cur=e.detail.current},c=(e=[],t=1)=>{const o=[];let a=[];return e.forEach((e=>{a.length===t&&(a=[]),0===a.length&&o.push(a),a.push(e)})),o};return(c,i)=>e.e({a:e.f(u.value,((l,u,n)=>({a:e.f(l,((a,l,u)=>e.e({a:a.badge.show},a.badge.show?{b:e.t(a.badge.text),c:e.s({background:a.badge.bgColor,color:a.badge.textColor})}:{},{d:a.iconUrl},a.iconUrl?{e:e.s({width:r.iconSize+"rpx",height:r.iconSize+"rpx"}),f:e.unref(t.sheep).$url.cdn(a.iconUrl)}:{},"iconText"===o.data.layout?{g:e.t(a.title),h:e.s({color:a.titleColor})}:{},{i:l,j:e.o((o=>e.unref(t.sheep).$router.go(a.url)),l)}))),b:u,c:a.cur==u?1:""}))),b:"iconText"===o.data.layout,c:e.s({width:1/o.data.column*100+"%",height:"200rpx"}),d:r.circular,e:a.cur,f:r.autoplay,g:r.interval,h:r.duration,i:e.s({height:n.value+"rpx"}),j:e.o(d),k:u.value.length>1},u.value.length>1?e.e({l:"tag"!=r.dotStyle},"tag"!=r.dotStyle?{m:e.f(u.value.length,((t,o,r)=>({a:o,b:e.n(a.cur==o?"cur":"")}))),n:e.n(r.dotCur),o:e.n(r.dotStyle)}:{},{p:"tag"==r.dotStyle},"tag"==r.dotStyle?{q:e.t(a.cur+1),r:e.t(u.value.length),s:e.n(r.dotCur),t:e.n(r.dotStyle)}:{}):{},{v:e.n(r.mode),w:e.n(r.ui),x:e.s(l.value),y:e.s({height:n.value+(u.value.length>1?50:0)+"rpx"})})}},a=e._export_sfc(o,[["__scopeId","data-v-ce95b218"]]);wx.createComponent(a);