1 |
- import{d as O,ar as s,y as V,e as M,r as A,n as P,a as k,o as j,C as D,m as F,a2 as G,d2 as H,f as J,d3 as K,__tla as N}from"./index-1f518666.js";import{E as Q,__tla as R}from"./el-image-viewer-91778fd6.js";let T,U=Promise.all([(()=>{try{return N}catch{}})(),(()=>{try{return R}catch{}})()]).then(async()=>{const z=O({name:"ImageViewer",__name:"ImageViewer",props:{urlList:{type:Array,default:()=>[]},zIndex:s.number.def(200),initialIndex:s.number.def(0),infinite:s.bool.def(!0),hideOnClickModal:s.bool.def(!1),appendToBody:s.bool.def(!1),show:s.bool.def(!1)},setup(g){const m=V(),f=M(()=>m.getMobile),d=g,v=M(()=>{const o={...d};return delete o.show,o}),r=A(d.show);console.log(r.value),r.value&&I();const h=()=>{r.value=!1,I()};let n=document.querySelector(".el-image-viewer__img"),t=document.querySelector(".el-image-viewer__wrapper"),c=0,_=0,x=0,L=0,u=!0;const e={scale:1};function X(o){var l=o.touches,a=l[0],i=l[1];o&&(e.pageX=a.pageX,e.pageY=a.pageY,e.moveable=!0,i&&(e.pageX2=i.pageX,e.pageY2=i.pageY),e.originScale=e.scale||1)}function Y(o){if(e.moveable){var l=o.touches,a=l[0],i=l[1];if(i){e.pageX2||(e.pageX2=i.pageX),e.pageY2||(e.pageY2=i.pageY);var S=function(C,q){return Math.hypot(q.x-C.x,q.y-C.y)},B=S({x:a.pageX,y:a.pageY},{x:i.pageX,y:i.pageY})/S({x:e.pageX,y:e.pageY},{x:e.pageX2,y:e.pageY2}),p=e.originScale*B;p>3&&(p=3),e.scale=p,n.style.transform="scale("+p+")",n.style.transition="transform .3s"}}}function w(o){u=!1,e.moveable=!1,delete e.pageX2,delete e.pageY2}function E(o){u=!0,o.touches.length===1&&u&&(c=o.touches[0].clientX,_=o.touches[0].clientY,x=c-n.offsetLeft,L=_-n.offsetTop)}function b(o){if(o.touches.length==1&&u){const l=o.touches[0].clientX,a=o.touches[0].clientY;n.style.position!="fixed"&&(n.style.position="fixed"),n.style.left=l-x+"px",n.style.top=a-L+"px"}}function I(){console.log("\u56FE\u7247\u663E\u793A\u9690\u85CF\u5904\u7406"),P(()=>{n=document.querySelector(".el-image-viewer__img"),t=document.querySelector(".el-image-viewer__wrapper"),r.value?(f&&(document.querySelector(".el-image-viewer__actions").style.display="none"),t.addEventListener("touchstart",X),t.addEventListener("touchmove",Y),t.addEventListener("touchend",w),t.addEventListener("touchcancel",function(){e.moveable=!1,delete e.pageX2,delete e.pageY2}),n.addEventListener("touchstart",E),n.addEventListener("touchmove",b)):(t&&(t.removeEventListener("touchstart",X),t.removeEventListener("touchmove",Y),t.removeEventListener("touchend",w)),n&&(n.removeEventListener("touchstart",E),n.removeEventListener("touchmove",b)))})}return(o,l)=>{const a=Q;return k(r)?(j(),D(a,F({key:0},k(v),{onClose:h}),null,16)):G("",!0)}}});let y=null;T=function(g){if(!H)return;const{urlList:m,initialIndex:f=0,infinite:d=!0,hideOnClickModal:v=!1,appendToBody:r=!1,zIndex:h=2e3,show:n=!0}=g,t={},c=document.createElement("div");t.urlList=m,t.initialIndex=f,t.infinite=d,t.hideOnClickModal=v,t.appendToBody=r,t.zIndex=h,t.show=n,document.body.appendChild(c),y=J(z,t),K(y,c)}});export{U as __tla,T as c};
|