1 |
- import{d as B,ah as s,Z as O,L as z,r as A,ao as D,a as C,o as P,x as Q,ak as Z,Q as j,_ as F,bc as G,g as H,bd as J,__tla as K}from"./index-3fb48822.js";import{E as N,__tla as R}from"./el-image-viewer-ff953702.js";let M,U=Promise.all([(()=>{try{return K}catch{}})(),(()=>{try{return R}catch{}})()]).then(async()=>{const T=F(B({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(m){const g=O(),f=z(()=>g.getMobile),u=m,v=z(()=>{const o={...u};return delete o.show,o}),r=A(u.show);console.log(r.value),r.value&&I();const h=()=>{r.value=!1,I()};let a=document.querySelector(".el-image-viewer__img"),t=document.querySelector(".el-image-viewer__wrapper"),c=0,_=0,x=0,w=0,d=!0;const e={scale:1};function L(o){var l=o.touches,n=l[0],i=l[1];o&&(e.pageX=n.pageX,e.pageY=n.pageY,e.moveable=!0,i&&(e.pageX2=i.pageX,e.pageY2=i.pageY),e.originScale=e.scale||1)}function X(o){if(e.moveable){var l=o.touches,n=l[0],i=l[1];if(i){e.pageX2||(e.pageX2=i.pageX),e.pageY2||(e.pageY2=i.pageY);var S=function(k,q){return Math.hypot(q.x-k.x,q.y-k.y)},V=S({x:n.pageX,y:n.pageY},{x:i.pageX,y:i.pageY})/S({x:e.pageX,y:e.pageY},{x:e.pageX2,y:e.pageY2}),p=e.originScale*V;p>3&&(p=3),e.scale=p,a.style.transform="scale("+p+")",a.style.transition="transform .3s"}}}function Y(o){d=!1,e.moveable=!1,delete e.pageX2,delete e.pageY2}function b(o){d=!0,o.touches.length===1&&d&&(c=o.touches[0].clientX,_=o.touches[0].clientY,x=c-a.offsetLeft,w=_-a.offsetTop)}function E(o){if(o.touches.length==1&&d){const l=o.touches[0].clientX,n=o.touches[0].clientY;a.style.position!="fixed"&&(a.style.position="fixed"),a.style.left=l-x+"px",a.style.top=n-w+"px"}}function I(){console.log("\u56FE\u7247\u663E\u793A\u9690\u85CF\u5904\u7406"),D(()=>{a=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",L),t.addEventListener("touchmove",X),t.addEventListener("touchend",Y),t.addEventListener("touchcancel",function(){e.moveable=!1,delete e.pageX2,delete e.pageY2}),a.addEventListener("touchstart",b),a.addEventListener("touchmove",E)):(t&&(t.removeEventListener("touchstart",L),t.removeEventListener("touchmove",X),t.removeEventListener("touchend",Y)),a&&(a.removeEventListener("touchstart",b),a.removeEventListener("touchmove",E)))})}return(o,l)=>{const n=N;return C(r)?(P(),Q(n,Z({key:0},C(v),{onClose:h}),null,16)):j("",!0)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/components/ImageViewer/src/ImageViewer.vue"]]);let y=null;M=function(m){if(!G)return;const{urlList:g,initialIndex:f=0,infinite:u=!0,hideOnClickModal:v=!1,appendToBody:r=!1,zIndex:h=2e3,show:a=!0}=m,t={},c=document.createElement("div");t.urlList=g,t.initialIndex=f,t.infinite=u,t.hideOnClickModal=v,t.appendToBody=r,t.zIndex=h,t.show=a,document.body.appendChild(c),y=H(T,t),J(y,c)}});export{U as __tla,M as c};
|