1 |
- import{b as N,p as v,G as M,e as u,f as e,bD as Fe,bE as Ce,o as T,c as x,n as B,J as le,Z as z,E as ae,a as d,y as Te,C as xe,b5 as Be,a3 as Me,j as ke,A as De,F as $e,r as Oe,t as L,$ as He,a0 as Pe,_ as je}from"./index.4d3e3847.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 oe(){Array.isArray||(Array.isArray=function(S){return Object.prototype.toString.call(S)==="[object Array]"});let o,f,s,c,g,E,t=1,n=arguments[0]||{},m=!1,A=arguments.length;if(typeof n=="boolean"&&(m=n,n=arguments[1]||{},t++),typeof n!="object"&&typeof n!="function"&&(n={}),t===A)return n;for(;t<A;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,E=s&&Array.isArray(s)?s:[]):E=s&&typeof s=="object"?s:{},n[o]=oe(m,E,c)):c!==void 0&&(n[o]=c);return n}const Re=Object.freeze(Object.defineProperty({__proto__:null,animationFrame:Ie,arrayEqual:qe,copyObj:oe},Symbol.toStringTag,{value:"Module"})),We=["innerHTML"],ze=N({name:"ReSeamlessScroll"}),Le=N({...ze,props:{data:{type:Array},classOption:{type:Object}},emits:["scrollEnd"],setup(o,{expose:f,emit:s}){const c=o,{animationFrame:g,copyObj:E}=Re;g();let t=v(0),n=v(0),m=v(0),A=v(0),S=v(0),b=v(0),k=v(0),D=v(""),_=null,Y=null,$=null,U=null,V=null,O=!1,H="ease-in",{classOption:h}=c;h.key===void 0&&(h.key=0);const X=M(`wrap${h.key}`,null),G=M(`slotList${h.key}`,null),J=M(`realBox${h.key}`,null);let K=u(()=>e(t)<0),Z=u(()=>Math.abs(e(t))<e(b)-e(S)),se=u(()=>({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})),l=u(()=>E({},e(se),h));const ue=u(()=>e(K)?"":e(l).switchDisabledClass);let re=u(()=>e(Z)?"":e(l).switchDisabledClass),ce=u(()=>({position:"absolute",margin:`${e(A)/2}px 0 0 -${e(l).switchOffset}px`,transform:"translate(-100%,-50%)"})),fe=u(()=>({position:"absolute",margin:`${e(A)/2}px 0 0 ${e(S)+e(l).switchOffset}px`,transform:"translateY(-50%)"})),P=u(()=>e(l).direction!=="bottom"&&e(l).direction!=="top"),Q=u(()=>e(P)?{float:"left",overflow:"hidden"}:{overflow:"hidden"}),de=u(()=>({transform:`translate(${e(t)}px,${e(n)}px)`,transition:`all ${H} ${e(m)}ms`,overflow:"hidden"})),j=u(()=>e(l).navigation),I=u(()=>e(j)?!1:e(l).autoPlay),ee=u(()=>c.data.length>=e(l).limitMoveNum),te=u(()=>e(l).hoverStop&&e(I)&&e(ee)),q=u(()=>e(l).openTouch),ne=u(()=>e(l).isSingleRemUnit?parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1),R=u(()=>e(l).singleWidth*e(ne)),W=u(()=>e(l).singleHeight*e(ne)),w=u(()=>{let i,a=e(l).step;if(e(P)?i=e(R):i=e(W),i>0&&i%a>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 a});function me(){t.value=0,n.value=0,F(),ie()}function he(){if(!!e(K)){if(Math.abs(e(t))<e(l).switchSingleStep){t.value=0;return}t.value+=e(l).switchSingleStep}}function pe(){if(!!e(Z)){if(e(b)-e(S)+e(t)<e(l).switchSingleStep){t.value=e(S)-e(b);return}t.value-=e(l).switchSingleStep}}function F(){cancelAnimationFrame(Y||"")}function ve(i){if(!e(q))return;let a;const r=i.targetTouches[0],{waitTime:p,singleHeight:C,singleWidth:be}=e(l);$={x:r.pageX,y:r.pageY},U=e(n),V=e(t),!!C&&!!be?(a&&clearTimeout(a),a=setTimeout(()=>{F()},p+20)):F()}function we(i){if(!e(q)||i.targetTouches.length>1||i.scale&&i.scale!==1)return;const a=i.targetTouches[0],{direction:r}=e(l);let p={x:a.pageX-$.x,y:a.pageY-$.y};i.preventDefault();const C=Math.abs(p.x)<Math.abs(p.y)?1:0;C===1&&r==="bottom"||C===1&&r==="top"?n.value=U+p.y:(C===0&&r==="left"||C===0&&r==="right")&&(t.value=V+p.x)}function ye(){if(!e(q))return;let i;const a=e(l).direction;if(m.value=50,a==="top")e(n)>0&&(n.value=0);else if(a==="bottom"){let r=e(k)/2*-1;e(n)<r&&(n.value=r)}else if(a==="left")e(t)>0&&(t.value=0);else if(a==="right"){let r=e(b)*-1;e(t)<r&&(t.value=r)}i&&clearTimeout(i),i=setTimeout(()=>{m.value=0,y()},e(m))}function ge(){e(te)&&Ee()}function Se(){e(te)&&_e()}function y(){O||(Y=requestAnimationFrame(function(){const i=e(k)/2,a=e(b)/2;let{direction:r,waitTime:p}=e(l);r==="top"?(Math.abs(e(n))>=i&&(s("scrollEnd"),n.value=0),n.value-=w.value):r==="bottom"?(e(n)>=0&&(s("scrollEnd"),n.value=i*-1),n.value+=w.value):r==="left"?(Math.abs(e(t))>=a&&(s("scrollEnd"),t.value=0),t.value-=w.value):r==="right"&&(e(t)>=0&&(s("scrollEnd"),t.value=a*-1),t.value+=w.value),_&&clearTimeout(_),e(W)?Math.abs(e(n))%e(W)<e(w)?_=setTimeout(()=>{y()},p):y():e(R)&&Math.abs(e(t))%e(R)<e(w)?_=setTimeout(()=>{y()},p):y()}))}function ie(){Te(()=>{const{switchDelay:i}=e(l);if(D.value="",e(P)){A.value=e(X).offsetHeight,S.value=e(X).offsetWidth;let a=e(G).offsetWidth;e(I)&&(a=a*2+1),e(J).style.width=a+"px",b.value=a}if(e(I))H="ease-in",m.value=0;else{H="linear",m.value=i;return}e(ee)?(D.value=e(G).innerHTML,setTimeout(()=>{var a;k.value=(a=e(J))==null?void 0:a.offsetHeight,y()},0)):(F(),n.value=t.value=0)})}function _e(){O=!1,y()}function Ee(){O=!0,_&&clearTimeout(_),F()}function Ae(i){e(l).direction==="left"||e(l).direction==="right"||xe(()=>{i.deltaY>0?n.value-=w.value:n.value+=w.value},50)()}return Fe(()=>{ie()}),Ce(()=>{F(),clearTimeout(_)}),f({reset:me}),(i,a)=>(T(),x("div",{ref:"wrap"+e(h).key},[e(j)?(T(),x("div",{key:0,style:B(e(ce)),class:le(e(ue)),onClick:he},[z(i.$slots,"left-switch")],6)):ae("",!0),e(j)?(T(),x("div",{key:1,style:B(e(fe)),class:le(e(re)),onClick:pe},[z(i.$slots,"right-switch")],6)):ae("",!0),d("div",{ref:"realBox"+e(h).key,style:B(e(de)),onMouseenter:ge,onMouseleave:Se,onTouchstartPassive:ve,onTouchmovePassive:we,onTouchend:ye,onMousewheelPassive:Ae},[d("div",{ref:"slotList"+e(h).key,style:B(e(Q))},[z(i.$slots,"default")],4),d("div",{innerHTML:e(D),style:B(e(Q))},null,12,We)],36)],512))}}),Ne=Be(Le),Ye=Ne,Ue=o=>(He("data-v-521509a6"),o=o(),Pe(),o),Ve={class:"infinite"},Xe=Ue(()=>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)),Ge={class:"item"},Je=["textContent"],Ke=["textContent"],Ze=["textContent"],Qe=N({__name:"Infinite",setup(o){const f=M("scroll",null);let s=v([{date:"2021-09-01",name:"\u4E94\u5E38\u7A3B\u7530",star:"1000"},{date:"2021-09-02",name:"\u4E94\u5E38\u7A3B\u7530",star:"1100"},{date:"2021-09-03",name:"\u4E94\u5E38\u7A3B\u7530",star:"1200"},{date:"2021-09-04",name:"\u4E94\u5E38\u7A3B\u7530",star:"1300"},{date:"2021-09-05",name:"\u4E94\u5E38\u7A3B\u7530",star:"1400"},{date:"2021-09-06",name:"\u4E94\u5E38\u7A3B\u7530",star:"1500"},{date:"2021-09-07",name:"\u4E94\u5E38\u7A3B\u7530",star:"1600"},{date:"2021-09-08",name:"\u4E94\u5E38\u7A3B\u7530",star:"1700"},{date:"2021-09-09",name:"\u4E94\u5E38\u7A3B\u7530",star:"1800"},{date:"2021-09-10",name:"\u4E94\u5E38\u7A3B\u7530",star:"1900"}]),c=Me({direction:"top"});return(g,E)=>(T(),x("div",Ve,[Xe,ke(e(Ye),{ref_key:"scroll",ref:f,data:e(s),"class-option":e(c),class:"warp"},{default:De(()=>[d("ul",Ge,[(T(!0),x($e,null,Oe(e(s),(t,n)=>(T(),x("li",{key:n},[d("span",{textContent:L(t.date)},null,8,Je),d("span",{textContent:L(t.name)},null,8,Ke),d("span",{textContent:L(t.star)},null,8,Ze)]))),128))])]),_:1},8,["data","class-option"])]))}});const tt=je(Qe,[["__scopeId","data-v-521509a6"]]);export{tt as default};
|