u-swiper.js 7.1 KB
"use strict";const r=require("../../../../common/vendor.js"),q=require("./props.js"),d=require("../../libs/mixin/mpMixin.js"),l=require("../../libs/mixin/mixin.js");require("../../libs/config/props.js");require("../../libs/config/config.js");require("../../libs/config/props/actionSheet.js");require("../../libs/config/props/album.js");require("../../libs/config/props/alert.js");require("../../libs/config/props/avatar.js");require("../../libs/config/props/avatarGroup.js");require("../../libs/config/props/backtop.js");require("../../libs/config/props/badge.js");require("../../libs/config/props/button.js");require("../../libs/config/props/calendar.js");require("../../libs/config/props/carKeyboard.js");require("../../libs/config/props/cell.js");require("../../libs/config/props/cellGroup.js");require("../../libs/config/props/checkbox.js");require("../../libs/config/props/checkboxGroup.js");require("../../libs/config/props/circleProgress.js");require("../../libs/config/props/code.js");require("../../libs/config/props/codeInput.js");require("../../libs/config/props/col.js");require("../../libs/config/props/collapse.js");require("../../libs/config/props/collapseItem.js");require("../../libs/config/props/columnNotice.js");require("../../libs/config/props/countDown.js");require("../../libs/config/props/countTo.js");require("../../libs/config/props/datetimePicker.js");require("../../libs/config/props/divider.js");require("../../libs/config/props/empty.js");require("../../libs/config/props/form.js");require("../../libs/config/props/formItem.js");require("../../libs/config/props/gap.js");require("../../libs/config/props/grid.js");require("../../libs/config/props/gridItem.js");require("../../libs/config/props/icon.js");require("../../libs/config/props/image.js");require("../../libs/config/props/indexAnchor.js");require("../../libs/config/props/indexList.js");require("../../libs/config/props/input.js");require("../../libs/config/props/keyboard.js");require("../../libs/config/props/line.js");require("../../libs/config/props/lineProgress.js");require("../../libs/config/props/link.js");require("../../libs/config/props/list.js");require("../../libs/config/props/listItem.js");require("../../libs/config/props/loadingIcon.js");require("../../libs/config/props/loadingPage.js");require("../../libs/config/props/loadmore.js");require("../../libs/config/props/modal.js");require("../../libs/config/props/navbar.js");require("../../libs/config/color.js");require("../../libs/config/props/noNetwork.js");require("../../libs/config/props/noticeBar.js");require("../../libs/config/props/notify.js");require("../../libs/config/props/numberBox.js");require("../../libs/config/props/numberKeyboard.js");require("../../libs/config/props/overlay.js");require("../../libs/config/props/parse.js");require("../../libs/config/props/picker.js");require("../../libs/config/props/popup.js");require("../../libs/config/props/radio.js");require("../../libs/config/props/radioGroup.js");require("../../libs/config/props/rate.js");require("../../libs/config/props/readMore.js");require("../../libs/config/props/row.js");require("../../libs/config/props/rowNotice.js");require("../../libs/config/props/scrollList.js");require("../../libs/config/props/search.js");require("../../libs/config/props/section.js");require("../../libs/config/props/skeleton.js");require("../../libs/config/props/slider.js");require("../../libs/config/props/statusBar.js");require("../../libs/config/props/steps.js");require("../../libs/config/props/stepsItem.js");require("../../libs/config/props/sticky.js");require("../../libs/config/props/subsection.js");require("../../libs/config/props/swipeAction.js");require("../../libs/config/props/swipeActionItem.js");require("../../libs/config/props/swiper.js");require("../../libs/config/props/swipterIndicator.js");require("../../libs/config/props/switch.js");require("../../libs/config/props/tabbar.js");require("../../libs/config/props/tabbarItem.js");require("../../libs/config/props/tabs.js");require("../../libs/config/props/tag.js");require("../../libs/config/props/text.js");require("../../libs/config/props/textarea.js");require("../../libs/config/props/toast.js");require("../../libs/config/props/toolbar.js");require("../../libs/config/props/tooltip.js");require("../../libs/config/props/transition.js");require("../../libs/config/props/upload.js");require("../../libs/config/props/drawer.js");const c={name:"u-swiper",mixins:[d.mpMixin,l.mixin,q.props],data(){return{currentIndex:0}},watch:{current(e,n){e!==n&&(this.currentIndex=e)}},computed:{itemStyle(){return e=>{const n={};return this.nextMargin&&this.previousMargin&&(n.borderRadius=r.index.$u.addUnit(this.radius),e!==this.currentIndex&&(n.transform="scale(0.92)")),n}}},methods:{getItemType(e){if(typeof e=="string")return r.index.$u.test.video(this.getSource(e))?"video":"image";if(typeof e=="object"&&this.keyName)return e.type?e.type==="image"?"image":e.type==="video"?"video":"image":r.index.$u.test.video(this.getSource(e))?"video":"image"},getSource(e){return typeof e=="string"?e:typeof e=="object"&&this.keyName?e[this.keyName]:(r.index.$u.error("请按格式传递列表参数"),"")},change(e){const{current:n}=e.detail;this.pauseVideo(this.currentIndex),this.currentIndex=n,this.$emit("change",e.detail)},pauseVideo(e){const n=this.getSource(this.list[e]);r.index.$u.test.video(n)&&r.index.createVideoContext(`video-${e}`,this).pause()},getPoster(e){return typeof e=="object"&&e.poster?e.poster:""},clickHandler(e){this.$emit("click",e)}}};if(!Array){const e=r.resolveComponent("u-loading-icon"),n=r.resolveComponent("u-swiper-indicator");(e+n)()}const g=()=>"../u-loading-icon/u-loading-icon.js",h=()=>"../u-swiper-indicator/u-swiper-indicator.js";Math||(g+h)();function p(e,n,o,m,s,u){return r.e({a:e.loading},e.loading?{b:r.p({mode:"circle"})}:{c:r.f(e.list,(i,t,y)=>r.e({a:u.getItemType(i)==="image"},u.getItemType(i)==="image"?{b:u.getSource(i),c:e.imgMode,d:r.o(a=>u.clickHandler(t),t),e:e.$u.addUnit(e.height),f:e.$u.addUnit(e.radius)}:{},{g:u.getItemType(i)==="video"},u.getItemType(i)==="video"?{h:`video-${t}`,i:u.getSource(i),j:u.getPoster(i),k:e.showTitle&&e.$u.test.object(i)&&i.title?i.title:"",l:e.$u.addUnit(e.height),m:r.o(a=>u.clickHandler(t),t)}:{},{n:e.showTitle&&e.$u.test.object(i)&&i.title&&e.$u.test.image(u.getSource(i))},e.showTitle&&e.$u.test.object(i)&&i.title&&e.$u.test.image(u.getSource(i))?{o:r.t(i.title)}:{},{p:r.s(u.itemStyle(t)),q:t})),d:e.$u.addUnit(e.height),e:r.o((...i)=>u.change&&u.change(...i)),f:e.circular,g:e.interval,h:e.duration,i:e.autoplay,j:e.current,k:e.currentItemId,l:e.$u.addUnit(e.previousMargin),m:e.$u.addUnit(e.nextMargin),n:e.acceleration,o:e.displayMultipleItems,p:e.easingFunction},{q:!e.loading&&e.indicator&&!e.showTitle},!e.loading&&e.indicator&&!e.showTitle?{r:r.p({indicatorActiveColor:e.indicatorActiveColor,indicatorInactiveColor:e.indicatorInactiveColor,length:e.list.length,current:s.currentIndex,indicatorMode:e.indicatorMode})}:{},{s:r.s(e.$u.addStyle(e.indicatorStyle)),t:e.bgColor,v:e.$u.addUnit(e.height),w:e.$u.addUnit(e.radius)})}const v=r._export_sfc(c,[["render",p],["__scopeId","data-v-4e7d0c90"],["__file","D:/vue/大健康商城/healthMall/uni_modules/uview-plus/components/u-swiper/u-swiper.vue"]]);wx.createComponent(v);