1 |
- import{_ as le,d as oe,w as v,p as E,ag as r,l as e,aQ as Te,aR as xe,o as x,c as M,N as k,B as ie,ar as W,a as ae,h as d,y as Me,a1 as ke,aK as Ee,Z as De,j as Be,C as Oe,F as $e,D as je,L as z,Q as He,R as Re}from"./index.js";const Ie=()=>{window.cancelAnimationFrame=(()=>window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(o){return window.clearTimeout(o)})(),window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(o){return window.setTimeout(o,1e3/60)}}()},qe=(o,f)=>{if(o===f)return!0;if(o.length!==f.length)return!1;for(let s=0;s<o.length;++s)if(o[s]!==f[s])return!1;return!0};function se(){Array.isArray||(Array.isArray=function(S){return Object.prototype.toString.call(S)==="[object Array]"});let o,f,s,c,g,C,t=1,n=arguments[0]||{},m=!1,F=arguments.length;if(typeof n=="boolean"&&(m=n,n=arguments[1]||{},t++),typeof n!="object"&&typeof n!="function"&&(n={}),t===F)return n;for(;t<F;t++)if((f=arguments[t])!=null)for(o in f)s=n[o],c=f[o],g=Array.isArray(c),m&&c&&(typeof c=="object"||g)?(g?(g=!1,C=s&&Array.isArray(s)?s:[]):C=s&&typeof s=="object"?s:{},n[o]=se(m,C,c)):c!==void 0&&(n[o]=c);return n}var Pe=Object.freeze(Object.defineProperty({__proto__:null,animationFrame:Ie,arrayEqual:qe,copyObj:se},Symbol.toStringTag,{value:"Module"}));const Le=["innerHTML"],We={name:"ReSeamlessScroll"},ze=oe({...We,props:{data:{type:Array},classOption:{type:Object}},emits:["scrollEnd"],setup(o,{expose:f,emit:s}){const c=o,{animationFrame:g,copyObj:C}=Pe;g();let t=v(0),n=v(0),m=v(0),F=v(0),S=v(0),b=v(0),D=v(0),B=v(""),_=null,N=null,O=null,U=null,Y=null,$=!1,j="ease-in",{classOption:p}=c;p.key===void 0&&(p.key=0);const V=E(`wrap${p.key}`,null),X=E(`slotList${p.key}`,null),Q=E(`realBox${p.key}`,null);let K=r(()=>e(t)<0),Z=r(()=>Math.abs(e(t))<e(b)-e(S)),re=r(()=>({step:1,limitMoveNum:5,hoverStop:!0,direction:"top",openTouch:!0,singleHeight:0,singleWidth:0,waitTime:1e3,switchOffset:30,autoPlay:!0,navigation:!1,switchSingleStep:134,switchDelay:400,switchDisabledClass:"disabled",isSingleRemUnit:!1})),a=r(()=>C({},e(re),p));const ue=r(()=>e(K)?"":e(a).switchDisabledClass);let ce=r(()=>e(Z)?"":e(a).switchDisabledClass),fe=r(()=>({position:"absolute",margin:`${e(F)/2}px 0 0 -${e(a).switchOffset}px`,transform:"translate(-100%,-50%)"})),de=r(()=>({position:"absolute",margin:`${e(F)/2}px 0 0 ${e(S)+e(a).switchOffset}px`,transform:"translateY(-50%)"})),H=r(()=>e(a).direction!=="bottom"&&e(a).direction!=="top"),G=r(()=>e(H)?{float:"left",overflow:"hidden"}:{overflow:"hidden"}),me=r(()=>({transform:`translate(${e(t)}px,${e(n)}px)`,transition:`all ${j} ${e(m)}ms`,overflow:"hidden"})),R=r(()=>e(a).navigation),I=r(()=>e(R)?!1:e(a).autoPlay),J=r(()=>c.data.length>=e(a).limitMoveNum),ee=r(()=>e(a).hoverStop&&e(I)&&e(J)),q=r(()=>e(a).openTouch),te=r(()=>e(a).isSingleRemUnit?parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1),P=r(()=>e(a).singleWidth*e(te)),L=r(()=>e(a).singleHeight*e(te)),w=r(()=>{let i,l=e(a).step;if(e(H)?i=e(P):i=e(L),i>0&&i%l>0)throw"\u5982\u679C\u8BBE\u7F6E\u4E86\u5355\u6B65\u6EDA\u52A8\uFF0Cstep\u9700\u662F\u5355\u6B65\u5927\u5C0F\u7684\u7EA6\u6570\uFF0C\u5426\u5219\u65E0\u6CD5\u4FDD\u8BC1\u5355\u6B65\u6EDA\u52A8\u7ED3\u675F\u7684\u4F4D\u7F6E\u662F\u5426\u51C6\u786E";return l});function pe(){t.value=0,n.value=0,A(),ne()}function he(){if(!!e(K)){if(Math.abs(e(t))<e(a).switchSingleStep){t.value=0;return}t.value+=e(a).switchSingleStep}}function ve(){if(!!e(Z)){if(e(b)-e(S)+e(t)<e(a).switchSingleStep){t.value=e(S)-e(b);return}t.value-=e(a).switchSingleStep}}function A(){cancelAnimationFrame(N||"")}function we(i){if(!e(q))return;let l;const u=i.targetTouches[0],{waitTime:h,singleHeight:T,singleWidth:Ae}=e(a);O={x:u.pageX,y:u.pageY},U=e(n),Y=e(t),!!T&&!!Ae?(l&&clearTimeout(l),l=setTimeout(()=>{A()},h+20)):A()}function ye(i){if(!e(q)||i.targetTouches.length>1||i.scale&&i.scale!==1)return;const l=i.targetTouches[0],{direction:u}=e(a);let h={x:l.pageX-O.x,y:l.pageY-O.y};i.preventDefault();const T=Math.abs(h.x)<Math.abs(h.y)?1:0;T===1&&u==="bottom"||T===1&&u==="top"?n.value=U+h.y:(T===0&&u==="left"||T===0&&u==="right")&&(t.value=Y+h.x)}function ge(){if(!e(q))return;let i;const l=e(a).direction;if(m.value=50,l==="top")e(n)>0&&(n.value=0);else if(l==="bottom"){let u=e(D)/2*-1;e(n)<u&&(n.value=u)}else if(l==="left")e(t)>0&&(t.value=0);else if(l==="right"){let u=e(b)*-1;e(t)<u&&(t.value=u)}i&&clearTimeout(i),i=setTimeout(()=>{m.value=0,y()},e(m))}function Se(){e(ee)&&Fe()}function _e(){e(ee)&&Ce()}function y(){$||(N=requestAnimationFrame(function(){const i=e(D)/2,l=e(b)/2;let{direction:u,waitTime:h}=e(a);u==="top"?(Math.abs(e(n))>=i&&(s("scrollEnd"),n.value=0),n.value-=w.value):u==="bottom"?(e(n)>=0&&(s("scrollEnd"),n.value=i*-1),n.value+=w.value):u==="left"?(Math.abs(e(t))>=l&&(s("scrollEnd"),t.value=0),t.value-=w.value):u==="right"&&(e(t)>=0&&(s("scrollEnd"),t.value=l*-1),t.value+=w.value),_&&clearTimeout(_),e(L)?Math.abs(e(n))%e(L)<e(w)?_=setTimeout(()=>{y()},h):y():e(P)&&Math.abs(e(t))%e(P)<e(w)?_=setTimeout(()=>{y()},h):y()}))}function ne(){Me(()=>{const{switchDelay:i}=e(a);if(B.value="",e(H)){F.value=e(V).offsetHeight,S.value=e(V).offsetWidth;let l=e(X).offsetWidth;e(I)&&(l=l*2+1),e(Q).style.width=l+"px",b.value=l}if(e(I))j="ease-in",m.value=0;else{j="linear",m.value=i;return}e(J)?(B.value=e(X).innerHTML,setTimeout(()=>{D.value=e(Q).offsetHeight,y()},0)):(A(),n.value=t.value=0)})}function Ce(){$=!1,y()}function Fe(){$=!0,_&&clearTimeout(_),A()}function be(i){i.preventDefault(),!(e(a).direction==="left"||e(a).direction==="right")&&ke(()=>{i.deltaY>0?n.value-=w.value:n.value+=w.value},50)()}return Te(()=>{ne()}),xe(()=>{A(),clearTimeout(_)}),f({reset:pe}),(i,l)=>(x(),M("div",{ref:"wrap"+e(p).key},[e(R)?(x(),M("div",{key:0,style:k(e(fe)),class:ie(e(ue)),onClick:he},[W(i.$slots,"left-switch")],6)):ae("v-if",!0),e(R)?(x(),M("div",{key:1,style:k(e(de)),class:ie(e(ce)),onClick:ve},[W(i.$slots,"right-switch")],6)):ae("v-if",!0),d("div",{ref:"realBox"+e(p).key,style:k(e(me)),onMouseenter:Se,onMouseleave:_e,onTouchstart:we,onTouchmove:ye,onTouchend:ge,onMousewheel:be},[d("div",{ref:"slotList"+e(p).key,style:k(e(G))},[W(i.$slots,"default")],4),d("div",{innerHTML:e(B),style:k(e(G))},null,12,Le)],36)],512))}});var Ne=le(ze,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/components/ReSeamlessScroll/src/index.vue"]]);const Ue=Ee(Ne);const Ye=o=>(He("data-v-1ac0eab6"),o=o(),Re(),o),Ve={class:"infinite"},Xe=Ye(()=>d("ul",{class:"top"},[d("li",null,"\u66F4\u65B0\u65E5\u671F"),d("li",null,"\u9879\u76EE\u540D\u79F0"),d("li",null,"Star\u6570\u91CF")],-1)),Qe={class:"item"},Ke=["textContent"],Ze=["textContent"],Ge=["textContent"],Je=oe({__name:"Infinite",setup(o){const f=E("scroll",null);let s=v([{date:"2021-09-01",name:"\u91C7\u9500365",star:"1000"},{date:"2021-09-02",name:"\u91C7\u9500365",star:"1100"},{date:"2021-09-03",name:"\u91C7\u9500365",star:"1200"},{date:"2021-09-04",name:"\u91C7\u9500365",star:"1300"},{date:"2021-09-05",name:"\u91C7\u9500365",star:"1400"},{date:"2021-09-06",name:"\u91C7\u9500365",star:"1500"},{date:"2021-09-07",name:"\u91C7\u9500365",star:"1600"},{date:"2021-09-08",name:"\u91C7\u9500365",star:"1700"},{date:"2021-09-09",name:"\u91C7\u9500365",star:"1800"},{date:"2021-09-10",name:"\u91C7\u9500365",star:"1900"}]),c=De({direction:"top"});return(g,C)=>(x(),M("div",Ve,[Xe,Be(e(Ue),{ref_key:"scroll",ref:f,data:e(s),"class-option":e(c),class:"warp"},{default:Oe(()=>[d("ul",Qe,[(x(!0),M($e,null,je(e(s),(t,n)=>(x(),M("li",{key:n},[d("span",{textContent:z(t.date)},null,8,Ke),d("span",{textContent:z(t.name)},null,8,Ze),d("span",{textContent:z(t.star)},null,8,Ge)]))),128))])]),_:1},8,["data","class-option"])]))}});var tt=le(Je,[["__scopeId","data-v-1ac0eab6"],["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/welcome/components/Infinite.vue"]]);export{tt as default};
|