index-5a40c383.js 3.0 KB

1
  1. import{d as B,as as r,y as O,e as z,r as A,n as D,a as M,o as P,C as j,m as F,a3 as G,_ as H,d4 as J,f as K,d5 as N,__tla as Q}from"./index-286756b9.js";import{E as R,__tla as U}from"./el-image-viewer-e0e5d3be.js";let k,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),d=m,v=z(()=>{const n={...d};return delete n.show,n}),s=A(d.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,w=0,u=!0;const e={scale:1};function L(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 X(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(C,q){return Math.hypot(q.x-C.x,q.y-C.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 Y(n){u=!1,e.moveable=!1,delete e.pageX2,delete e.pageY2}function E(n){u=!0,n.touches.length===1&&u&&(c=n.touches[0].clientX,_=n.touches[0].clientY,x=c-a.offsetLeft,w=_-a.offsetTop)}function b(n){if(n.touches.length==1&&u){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-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"),s.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",E),a.addEventListener("touchmove",b)):(t&&(t.removeEventListener("touchstart",L),t.removeEventListener("touchmove",X),t.removeEventListener("touchend",Y)),a&&(a.removeEventListener("touchstart",E),a.removeEventListener("touchmove",b)))})}return(n,l)=>{const o=R;return M(s)?(P(),j(o,F({key:0},M(v),{onClose:h}),null,16)):G("",!0)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/components/ImageViewer/src/ImageViewer.vue"]]);let y=null;k=function(m){if(!J)return;const{urlList:g,initialIndex:f=0,infinite:d=!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=d,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,k as c};