index-5f6db4a5.js 3.0 KB

1
  1. import{d as B,ai as r,b as O,e as z,r as A,ap as D,a as C,o as P,k as j,al as F,S as G,_ as H,bb as J,i as K,bc as N,__tla as Q}from"./index-2f799233.js";import{E as R,__tla as U}from"./el-image-viewer-8e9e3571.js";let M,W=Promise.all([(()=>{try{return Q}catch{}})(),(()=>{try{return U}catch{}})()]).then(async()=>{const T=H(B({name:"ImageViewer",__name:"ImageViewer",props:{urlList:{type:Array,default:()=>[]},zIndex:r.number.def(200),initialIndex:r.number.def(0),infinite:r.bool.def(!0),hideOnClickModal:r.bool.def(!1),appendToBody:r.bool.def(!1),show:r.bool.def(!1)},setup(m){const g=O(),f=z(()=>g.getMobile),u=m,v=z(()=>{const n={...u};return delete n.show,n}),s=A(u.show);console.log(s.value),s.value&&I();const h=()=>{s.value=!1,I()};let a=document.querySelector(".el-image-viewer__img"),t=document.querySelector(".el-image-viewer__wrapper"),c=0,_=0,x=0,b=0,d=!0;const e={scale:1};function w(n){var l=n.touches,o=l[0],i=l[1];n&&(e.pageX=o.pageX,e.pageY=o.pageY,e.moveable=!0,i&&(e.pageX2=i.pageX,e.pageY2=i.pageY),e.originScale=e.scale||1)}function L(n){if(e.moveable){var l=n.touches,o=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:o.pageX,y:o.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 X(n){d=!1,e.moveable=!1,delete e.pageX2,delete e.pageY2}function Y(n){d=!0,n.touches.length===1&&d&&(c=n.touches[0].clientX,_=n.touches[0].clientY,x=c-a.offsetLeft,b=_-a.offsetTop)}function E(n){if(n.touches.length==1&&d){const l=n.touches[0].clientX,o=n.touches[0].clientY;a.style.position!="fixed"&&(a.style.position="fixed"),a.style.left=l-x+"px",a.style.top=o-b+"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"),s.value?(f&&(document.querySelector(".el-image-viewer__actions").style.display="none"),t.addEventListener("touchstart",w),t.addEventListener("touchmove",L),t.addEventListener("touchend",X),t.addEventListener("touchcancel",function(){e.moveable=!1,delete e.pageX2,delete e.pageY2}),a.addEventListener("touchstart",Y),a.addEventListener("touchmove",E)):(t&&(t.removeEventListener("touchstart",w),t.removeEventListener("touchmove",L),t.removeEventListener("touchend",X)),a&&(a.removeEventListener("touchstart",Y),a.removeEventListener("touchmove",E)))})}return(n,l)=>{const o=R;return C(s)?(P(),j(o,F({key:0},C(v),{onClose:h}),null,16)):G("",!0)}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/components/ImageViewer/src/ImageViewer.vue"]]);let y=null;M=function(m){if(!J)return;const{urlList:g,initialIndex:f=0,infinite:u=!0,hideOnClickModal:v=!1,appendToBody:s=!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=s,t.zIndex=h,t.show=a,document.body.appendChild(c),y=K(T,t),N(y,c)}});export{W as __tla,M as c};