v3-simple-img-preview
Version:
1 lines • 30 kB
JavaScript
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["v3-simple-img-preview"]=t(require("vue")):e["v3-simple-img-preview"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(e){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s="fb15")}({"0444":function(e,t,o){"use strict";o("ae63")},"0757":function(e,t,o){"use strict";o("0c08")},"0c08":function(e,t,o){var n=o("3f1c");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var i=o("499e").default;i("17d63eed",n,!0,{sourceMap:!1,shadowMode:!1})},"24fb":function(e,t,o){"use strict";function n(e,t){var o=e[1]||"",n=e[3];if(!n)return o;if(t&&"function"===typeof btoa){var r=i(n),s=n.sources.map((function(e){return"/*# sourceURL=".concat(n.sourceRoot||"").concat(e," */")}));return[o].concat(s).concat([r]).join("\n")}return[o].join("\n")}function i(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(o," */")}e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o=n(t,e);return t[2]?"@media ".concat(t[2]," {").concat(o,"}"):o})).join("")},t.i=function(e,o,n){"string"===typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var r=0;r<this.length;r++){var s=this[r][0];null!=s&&(i[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);n&&i[c[0]]||(o&&(c[2]?c[2]="".concat(o," and ").concat(c[2]):c[2]=o),t.push(c))}},t}},"3f1c":function(e,t,o){var n=o("24fb");t=n(!1),t.push([e.i,".ysj-swipe-item[data-v-2a4dff36]{height:100%;width:100%;min-height:180px}",""]),e.exports=t},4137:function(e,t,o){"use strict";o("4ad9")},"499e":function(e,t,o){"use strict";function n(e,t){for(var o=[],n={},i=0;i<t.length;i++){var r=t[i],s=r[0],a=r[1],c=r[2],l=r[3],u={id:e+":"+i,css:a,media:c,sourceMap:l};n[s]?n[s].parts.push(u):o.push(n[s]={id:s,parts:[u]})}return o}o.r(t),o.d(t,"default",(function(){return m}));var i="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!i)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var r={},s=i&&(document.head||document.getElementsByTagName("head")[0]),a=null,c=0,l=!1,u=function(){},f=null,d="data-vue-ssr-id",h="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function m(e,t,o,i){l=o,f=i||{};var s=n(e,t);return p(s),function(t){for(var o=[],i=0;i<s.length;i++){var a=s[i],c=r[a.id];c.refs--,o.push(c)}t?(s=n(e,t),p(s)):s=[];for(i=0;i<o.length;i++){c=o[i];if(0===c.refs){for(var l=0;l<c.parts.length;l++)c.parts[l]();delete r[c.id]}}}}function p(e){for(var t=0;t<e.length;t++){var o=e[t],n=r[o.id];if(n){n.refs++;for(var i=0;i<n.parts.length;i++)n.parts[i](o.parts[i]);for(;i<o.parts.length;i++)n.parts.push(v(o.parts[i]));n.parts.length>o.parts.length&&(n.parts.length=o.parts.length)}else{var s=[];for(i=0;i<o.parts.length;i++)s.push(v(o.parts[i]));r[o.id]={id:o.id,refs:1,parts:s}}}}function g(){var e=document.createElement("style");return e.type="text/css",s.appendChild(e),e}function v(e){var t,o,n=document.querySelector("style["+d+'~="'+e.id+'"]');if(n){if(l)return u;n.parentNode.removeChild(n)}if(h){var i=c++;n=a||(a=g()),t=w.bind(null,n,i,!1),o=w.bind(null,n,i,!0)}else n=g(),t=y.bind(null,n),o=function(){n.parentNode.removeChild(n)};return t(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap)return;t(e=n)}else o()}}var b=function(){var e=[];return function(t,o){return e[t]=o,e.filter(Boolean).join("\n")}}();function w(e,t,o,n){var i=o?"":n.css;if(e.styleSheet)e.styleSheet.cssText=b(t,i);else{var r=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function y(e,t){var o=t.css,n=t.media,i=t.sourceMap;if(n&&e.setAttribute("media",n),f.ssrId&&e.setAttribute(d,t.id),i&&(o+="\n/*# sourceURL="+i.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),e.styleSheet)e.styleSheet.cssText=o;else{while(e.firstChild)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}},"4ad9":function(e,t,o){var n=o("596c");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var i=o("499e").default;i("607ace02",n,!0,{sourceMap:!1,shadowMode:!1})},"596c":function(e,t,o){var n=o("24fb");t=n(!1),t.push([e.i,".iconpark-icon[data-v-fb7fe6cc]{width:24px;height:24px;color:#fff}.ysj-image-container[data-v-fb7fe6cc]{background-color:#000;position:absolute;width:100%;top:0;left:0;right:0;bottom:0;z-index:999;color:#fff}.ysj-image-container-header[data-v-fb7fe6cc]{background-color:rgba(0,0,0,.3);position:absolute;left:0;top:0;height:44px;width:100%;line-height:44px;padding:0 10px;box-sizing:border-box;display:flex;justify-content:space-between;z-index:99}.ysj-image-opt[data-v-fb7fe6cc]{display:flex;align-content:center}.ysj-image-opt a[data-v-fb7fe6cc],.ysj-image-opt button[data-v-fb7fe6cc]{cursor:pointer;display:inline-block;height:44px;line-height:44px;width:28px;margin:0 10px;color:#fff;font-size:20px;background-color:transparent;border-width:0;text-align:center}.ysj-image-opt a[data-v-fb7fe6cc]:focus,.ysj-image-opt button[data-v-fb7fe6cc]:focus{outline-width:0}.ysj-image-arraw-left[data-v-fb7fe6cc]{left:10px}.ysj-image-arraw-left[data-v-fb7fe6cc],.ysj-image-arraw-right[data-v-fb7fe6cc]{position:absolute;top:50%;cursor:pointer;width:30px}.ysj-image-arraw-right[data-v-fb7fe6cc]{right:10px}.current-img[data-v-fb7fe6cc]{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.current-img[data-v-fb7fe6cc],.loading-wrapper[data-v-fb7fe6cc]{position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%)}.loading-wrapper[data-v-fb7fe6cc]{color:#999}.ysj-my-swipe[data-v-fb7fe6cc]{height:calc(100vh - 50px)}.ysj-my-swipe .ysj-swipe-item[data-v-fb7fe6cc]{display:flex;align-items:center;height:100%;justify-content:center}.ysj-my-swipe .img-item[data-v-fb7fe6cc]{max-width:100%;max-height:100%}.ysj-image-container-content[data-v-fb7fe6cc]{height:100vh;overflow:hidden;display:flex;align-items:center;justify-content:center}.ysj-image-container-content img[data-v-fb7fe6cc]{transition:all .3 ease}",""]),e.exports=t},"6b0d":function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=(e,t)=>{const o=e.__vccOpts||e;for(const[n,i]of t)o[n]=i;return o}},8875:function(e,t,o){var n,i,r;(function(o,s){i=[],n=s,r="function"===typeof n?n.apply(t,i):n,void 0===r||(e.exports=r)})("undefined"!==typeof self&&self,(function(){function e(){var t=Object.getOwnPropertyDescriptor(document,"currentScript");if(!t&&"currentScript"in document&&document.currentScript)return document.currentScript;if(t&&t.get!==e&&document.currentScript)return document.currentScript;try{throw new Error}catch(h){var o,n,i,r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,s=/@([^@]*):(\d+):(\d+)\s*$/gi,a=r.exec(h.stack)||s.exec(h.stack),c=a&&a[1]||!1,l=a&&a[2]||!1,u=document.location.href.replace(document.location.hash,""),f=document.getElementsByTagName("script");c===u&&(o=document.documentElement.outerHTML,n=new RegExp("(?:[^\\n]+?\\n){0,"+(l-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),i=o.replace(n,"$1").trim());for(var d=0;d<f.length;d++){if("interactive"===f[d].readyState)return f[d];if(f[d].src===c)return f[d];if(c===u&&f[d].innerHTML&&f[d].innerHTML.trim()===i)return f[d]}return null}}return e}))},"8bbf":function(t,o){t.exports=e},ae63:function(e,t,o){var n=o("fb36");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var i=o("499e").default;i("da58fb70",n,!0,{sourceMap:!1,shadowMode:!1})},fb15:function(e,t,o){"use strict";if(o.r(t),o.d(t,"previewImage",(function(){return ie})),o.d(t,"previewImageCom",(function(){return re})),"undefined"!==typeof window){var n=window.document.currentScript,i=o("8875");n=i(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:i});var r=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(o.p=r[1])}var s=o("8bbf"),a=function(e){return Object(s["pushScopeId"])("data-v-fb7fe6cc"),e=e(),Object(s["popScopeId"])(),e},c={class:"ysj-image-container"},l={class:"ysj-image-container-header"},u={key:0},f={key:1,class:"ysj-image-opt"},d=a((function(){return Object(s["createElementVNode"])("svg",{class:"iconpark-icon"},[Object(s["createElementVNode"])("use",{href:"#zoom-in"})],-1)})),h=[d],m=a((function(){return Object(s["createElementVNode"])("svg",{class:"iconpark-icon"},[Object(s["createElementVNode"])("use",{href:"#zoom-out"})],-1)})),p=[m],g=a((function(){return Object(s["createElementVNode"])("svg",{class:"iconpark-icon"},[Object(s["createElementVNode"])("use",{href:"#download-four"})],-1)})),v=[g],b=a((function(){return Object(s["createElementVNode"])("svg",{class:"iconpark-icon"},[Object(s["createElementVNode"])("use",{href:"#full-screen"})],-1)})),w=[b],y=a((function(){return Object(s["createElementVNode"])("svg",{class:"iconpark-icon"},[Object(s["createElementVNode"])("use",{href:"#close"})],-1)})),j=[y],k={class:"loading-wrapper"},O={class:"loading-wrapper"},x={key:1},C=["src"],X=a((function(){return Object(s["createElementVNode"])("svg",{class:"iconpark-icon"},[Object(s["createElementVNode"])("use",{href:"#left"})],-1)})),E=[X],M=a((function(){return Object(s["createElementVNode"])("svg",{class:"iconpark-icon"},[Object(s["createElementVNode"])("use",{href:"#right"})],-1)})),S=[M];function N(e,t,o,n,i,r){var a=Object(s["resolveComponent"])("swipe-item"),d=Object(s["resolveComponent"])("swipe");return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",c,[Object(s["createElementVNode"])("div",l,[Object(s["renderSlot"])(e.$slots,"default",{},void 0,!0),e.config.header?Object(s["createCommentVNode"])("",!0):(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",u,Object(s["toDisplayString"])(e.dataConfig.current+"/"+e.dataConfig.urls.length),1)),e.config.header||"Desktop"!==e.browserRedirect?Object(s["createCommentVNode"])("",!0):(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",f,[Object(s["createElementVNode"])("button",{onClick:t[0]||(t[0]=function(t){return e.zoom("big")})},h),Object(s["createElementVNode"])("button",{onClick:t[1]||(t[1]=function(t){return e.zoom("small")})},p),Object(s["createElementVNode"])("button",{onClick:t[2]||(t[2]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.dwonload&&e.dwonload.apply(e,t)})},v),Object(s["createElementVNode"])("button",{onClick:t[3]||(t[3]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.getFull&&e.getFull.apply(e,t)})},w),Object(s["createElementVNode"])("button",{onClick:t[4]||(t[4]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.close&&e.close.apply(e,t)})},j)]))]),"Desktop"===e.browserRedirect?(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{key:0,class:"ysj-image-container-content",onMousedown:t[5]||(t[5]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.mousedown&&e.mousedown.apply(e,t)}),onMousemove:t[6]||(t[6]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.mousemove&&e.mousemove.apply(e,t)}),onMouseup:t[7]||(t[7]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.mouseup&&e.mouseup.apply(e,t)})},[Object(s["withDirectives"])(Object(s["createElementVNode"])("span",k,"图片加载中",512),[[s["vShow"],e.loading]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",O,"图片加载失败",512),[[s["vShow"],e.error]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("img",{ref:"imgDom",alt:"",style:Object(s["normalizeStyle"])(e.imgTransform)},null,4),[[s["vShow"],!e.loading]])],32)):(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",x,[Object(s["createVNode"])(d,{class:"ysj-my-swipe",active:e.dataConfig.current-1,onChange:e.changeSwipe},{default:Object(s["withCtx"])((function(){return[(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.config.urls,(function(t,o){return Object(s["openBlock"])(),Object(s["createBlock"])(a,{key:t,onTouchstart:e.touchstart,onTouchmove:e.touchmove,onTouchend:e.touchend},{default:Object(s["withCtx"])((function(){return[Object(s["createElementVNode"])("img",{src:t,style:Object(s["normalizeStyle"])(o===e.dataConfig.current-1?e.imgStyle:null),alt:"",class:"img-item"},null,12,C)]})),_:2},1032,["onTouchstart","onTouchmove","onTouchend"])})),128))]})),_:1},8,["active","onChange"])])),e.dataConfig.current>1&&"Desktop"===e.browserRedirect?(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{key:2,class:"ysj-image-arraw-left",onClick:t[8]||(t[8]=Object(s["withModifiers"])((function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.arrawLeft&&e.arrawLeft.apply(e,t)}),["stop"]))},E)):Object(s["createCommentVNode"])("",!0),e.dataConfig.current<e.dataConfig.urls.length&&"Desktop"===e.browserRedirect?(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{key:3,class:"ysj-image-arraw-right",onClick:t[9]||(t[9]=Object(s["withModifiers"])((function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.arrawRight&&e.arrawRight.apply(e,t)}),["stop"]))},S)):Object(s["createCommentVNode"])("",!0)])}var Y=function(){!function(e){var t,o,n,i,r,s,a='<svg><symbol id="left" viewBox="0 0 48 48" fill="none"><path fill-opacity=".01" fill="#fff" d="M0 0h48v48H0z"/><path stroke-linejoin="round" stroke-linecap="round" stroke-width="4" stroke="currentColor" d="M31 36 19 24l12-12" data-follow-stroke="currentColor"/></symbol><symbol id="right" viewBox="0 0 48 48" fill="none"><path fill-opacity=".01" fill="#fff" d="M0 0h48v48H0z"/><path stroke-linejoin="round" stroke-linecap="round" stroke-width="4" stroke="currentColor" d="m19 12 12 12-12 12" data-follow-stroke="currentColor"/></symbol><symbol id="zoom-out" viewBox="0 0 48 48" fill="none"><path fill-opacity=".01" fill="#fff" d="M0 0h48v48H0z"/><path stroke-linejoin="round" stroke-width="4" stroke="currentColor" d="M21 38c9.389 0 17-7.611 17-17S30.389 4 21 4 4 11.611 4 21s7.611 17 17 17Z" data-follow-stroke="currentColor"/><path stroke-linejoin="round" stroke-linecap="round" stroke-width="4" stroke="currentColor" d="M15 21h12m6.222 12.222 8.485 8.485" data-follow-stroke="currentColor"/></symbol><symbol id="zoom-in" viewBox="0 0 48 48" fill="none"><path fill-opacity=".01" fill="#fff" d="M0 0h48v48H0z"/><path stroke-linejoin="round" stroke-width="4" stroke="currentColor" d="M21 38c9.389 0 17-7.611 17-17S30.389 4 21 4 4 11.611 4 21s7.611 17 17 17Z" data-follow-stroke="currentColor"/><path stroke-linejoin="round" stroke-linecap="round" stroke-width="4" stroke="currentColor" d="M21 15v12m-6-6h12m6.222 12.222 8.485 8.485" data-follow-stroke="currentColor"/></symbol><symbol id="download-four" viewBox="0 0 48 48" fill="none"><path stroke-linejoin="round" stroke-linecap="round" stroke-width="4" stroke="currentColor" d="M24 29 12 17h8V6h8v11h8L24 29Z" clip-rule="evenodd" data-follow-stroke="currentColor"/><path stroke-linecap="round" stroke-width="4" stroke="currentColor" d="M42 37H6m28 7H14" data-follow-stroke="currentColor"/></symbol><symbol id="full-screen" viewBox="0 0 48 48" fill="none"><path stroke-linejoin="round" stroke-linecap="round" stroke-width="4" stroke="currentColor" d="M33 6h9v9m0 18v9h-9m-18 0H6v-9m0-18V6h9" data-follow-stroke="currentColor"/></symbol><symbol id="close" viewBox="0 0 48 48" fill="none"><path fill-opacity=".01" fill="#fff" d="M0 0h48v48H0z"/><path stroke-linejoin="round" stroke-linecap="round" stroke-width="4" stroke="currentColor" d="m8 8 32 32M8 40 40 8" data-follow-stroke="currentColor"/></symbol></svg>';function c(){r||(r=!0,n())}t=function(){var e,t,o;(o=document.createElement("div")).innerHTML=a,a=null,(t=o.getElementsByTagName("svg")[0])&&(t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.width=0,t.style.height=0,t.style.overflow="hidden",e=t,(o=document.body).firstChild?(t=o.firstChild).parentNode.insertBefore(e,t):o.appendChild(e))},document.addEventListener?["complete","loaded","interactive"].indexOf(document.readyState)>-1?setTimeout(t,0):(o=function(){document.removeEventListener("DOMContentLoaded",o,!1),t()},document.addEventListener("DOMContentLoaded",o,!1)):document.attachEvent&&(n=t,i=e.document,r=!1,(s=function(){try{i.documentElement.doScroll("left")}catch(e){return void setTimeout(s,50)}c()})(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,c())})}(window)};function z(e,t,o,n,i,r){return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Object(s["mergeProps"])({class:"ysj-swipe-wrapper"},e.$attrs),[Object(s["createElementVNode"])("div",{class:"ysj-swipe__track",ref:"trackDom",onTouchstart:t[0]||(t[0]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.touchstart&&e.touchstart.apply(e,t)}),onTouchmove:t[1]||(t[1]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.touchmove&&e.touchmove.apply(e,t)}),onTouchend:t[2]||(t[2]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.touchend&&e.touchend.apply(e,t)})},[Object(s["renderSlot"])(e.$slots,"default",{},void 0,!0)],544)],16)}var B=window.outerWidth/4,D=Object(s["defineComponent"])({props:{loop:{type:Boolean,default:!1},active:{type:Number,default:0}},setup:function(){var e=Object(s["ref"])(),t=Object(s["ref"])(0),o=Object(s["ref"])(0),n=Object(s["ref"])(0),i=Object(s["ref"])(0),r=Object(s["ref"])(0),a=Object(s["ref"])(0),c=Object(s["reactive"])({active:0,width:0,swiping:!1});return{trackDom:e,startX:t,startY:o,state:c,deltaX:n,deltaY:i,offsetX:r,offsetY:a}},methods:{getStyle:function(){var e=this.$refs.trackDom;this.state.width=e.clientWidth,e.style.width=e.clientWidth*e.children.length+"px"},touchstart:function(e){this.reset(),this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY,this.state.swiping=!0},touchmove:function(e){if(this.state.swiping){var t=e.touches[0];this.deltaX=(t.clientX<0?0:t.clientX)-this.startX,this.deltaY=t.clientY-this.startY,this.offsetX=Math.abs(this.deltaX),this.offsetY=Math.abs(this.deltaY),this.deltaX>0?this.checkActive("right")&&this.move("right"):this.deltaX<0&&this.checkActive("left")&&this.move("left")}},touchend:function(e){if(this.state.swiping){var t=this.$refs.trackDom;this.state.swiping=!1,this.deltaX>B?(this.loop&&0===this.state.active&&(this.state.active=t.children.length-1),this.checkActive("right")&&(this.state.active-=1,this.move("right"))):this.deltaX<-B?(this.loop&&this.state.active===t.children.length-1&&(this.state.active=0),this.checkActive("left")&&(this.state.active+=1,this.move("left"))):this.move("")}},reset:function(){this.startX=0,this.startY=0,this.deltaX=0,this.deltaY=0,this.offsetX=0,this.offsetY=0},move:function(e){var t=this.$refs.trackDom;if(t.style.transitionDuration=(this.state.swiping?0:500)+"ms","left"===e){var o=this.state.active*this.state.width;this.state.swiping&&(o+=this.offsetX),t.style.transform="translateX(-"+o+"px)"}else if("right"===e){o=-this.state.active*this.state.width;this.state.swiping&&(o+=this.offsetX),t.style.transform="translateX("+o+"px)"}else{o=this.state.active*this.state.width;t.style.transform="translateX(-"+o+"px)"}!this.state.swiping&&e&&this.$emit("change",this.state.active)},checkActive:function(e){var t=this.$refs.trackDom,o=!0;return(this.loop||this.state.active!==t.children.length-1||"left"!==e)&&(this.loop||0!==this.state.active||"right"!==e)||(o=!1),console.log("result",o,e),o}},mounted:function(){var e=this;this.$nextTick((function(){e.getStyle()}))},watch:{active:{handler:function(e){var t=this;this.state.active=e,this.$nextTick((function(){t.move("")}))},immediate:!0}}}),P=(o("0444"),o("6b0d")),R=o.n(P);const I=R()(D,[["render",z],["__scopeId","data-v-149e9db8"]]);var V=I;function T(e,t,o,n,i,r){return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Object(s["mergeProps"])({class:"ysj-swipe-item"},e.$attrs),[Object(s["renderSlot"])(e.$slots,"default",{},void 0,!0)],16)}var _=Object(s["defineComponent"])({setup:function(){return{}}});o("0757");const $=R()(_,[["render",T],["__scopeId","data-v-2a4dff36"]]);var H=$,F=function(e){return e.stopPropagation()};function L(e,t){("boolean"!==typeof e.cancelable||e.cancelable)&&e.preventDefault(),t&&F(e)}function A(){var e=Object(s["ref"])(0),t=Object(s["ref"])(0),o=Object(s["ref"])(0),n=Object(s["ref"])(0),i=Object(s["ref"])(0),r=Object(s["ref"])(0),a=function(){o.value=0,n.value=0,i.value=0,r.value=0},c=function(o){a(),e.value=o.touches[0].clientX,t.value=o.touches[0].clientY},l=function(s){var a=s.touches[0];o.value=(a.clientX<0?0:a.clientX)-e.value,n.value=a.clientY-t.value,i.value=Math.abs(o.value),r.value=Math.abs(n.value)};return{move:l,start:c,reset:a,startX:e,startY:t,deltaX:o,deltaY:n,offsetX:i,offsetY:r}}var q,W,U,Z,G,J,K=A(),Q=Object(s["defineComponent"])({name:"img-preview",components:{swipe:V,swipeItem:H},props:{config:{type:Object,default:function(){return{maxZoom:3}}}},setup:function(){var e=Object(s["ref"])(),t=Object(s["ref"])({maxZoom:3,current:0,urls:[]}),o=Object(s["ref"])(!1),n=Object(s["ref"])(!1),i=Object(s["reactive"])({w:0,h:0}),r=Object(s["ref"])(1),a=Object(s["reactive"])({scale:1,moveX:0,moveY:0,moving:!1,zooming:!1,imageRatio:0,displayWidth:0,displayHeight:0}),c=Object(s["ref"])(!1),l=Object(s["reactive"])({startX:0,startY:0,offsetX:0,offsetY:0,originX:0,originY:0,isdown:!1});return{imgDom:e,dataConfig:t,loading:o,imgInfo:i,loadIcon:Y,error:n,state:a,zoomRate:r,isHidden:c,imgPosition:l}},computed:{browserRedirect:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Mobile":"Desktop"},imgStyle:function(){var e=this.state,t=e.scale,o=e.moveX,n=e.moveY,i=e.moving,r=e.zooming,s={transitionDuration:r||i?"0s":".3s"};if(1!==t){var a=o/t,c=n/t;s.transform="scale("+t+", "+t+") translate("+a+"px, "+c+"px)"}return s},imgTransform:function(){var e=this.imgPosition,t=e.offsetX,o=e.offsetY,n=e.isdown,i={transitionDuration:n?"0s":".3s",transform:"translate("+t+"px, "+o+"px)"};return i}},methods:{loadImage:function(){var e=this,t=window.innerWidth,o=window.innerHeight,n=t/o,i=this.$refs.imgDom;this.$nextTick((function(){e.loading=!0,i.removeAttribute("width"),i.removeAttribute("height"),e.dataConfig&&(i.src=e.dataConfig.urls[e.dataConfig.current-1]),e.error=!1,i.onload=function(){e.config.success&&e.config.success("success");var r=i.width/i.height;e.imgInfo.w=i.width,e.imgInfo.h=i.height,r>n?i.width>.7*t?(i.style.width=.7*t+"px",i.style.height=i.height/(i.width/(.7*t))+"px",e.imgInfo.w=.7*t,e.imgInfo.h=i.height/(i.width/(.7*t))):(i.style.width=i.width+"px",i.style.height=i.height+"px"):i.height>.7*o?(i.style.height=.7*o+"px",i.style.width=i.width/(i.height/(.7*o))+"px",e.imgInfo.w=i.width/(i.height/(.7*o)),e.imgInfo.h=.7*o):(i.style.width=i.width+"px",i.style.height=i.height+"px"),e.loading=!1},i.onerror=function(t){e.loading=!1,e.error=!0,e.config.fail&&e.config.fail("fail")}}))},arrawRight:function(){(this.dataConfig.current!=this.dataConfig.urls.length||this.dataConfig.loop)&&(this.resetImgPositon(),this.zoomRate=1,this.dataConfig.current===this.dataConfig.urls.length&&this.dataConfig.loop?this.dataConfig.current=1:this.dataConfig.current+=1,this.loadImage())},arrawLeft:function(){(1!=this.dataConfig.current||this.dataConfig.loop)&&(this.resetImgPositon(),this.zoomRate=1,this.dataConfig.loop&&1==this.dataConfig.current?this.dataConfig.current=this.dataConfig.urls.length:this.dataConfig.current-=1,this.loadImage())},getFull:function(){if(this.isFull()){var e=document.exitFullscreen;if(e)e.call(document);else if(window.ActiveXObject){var t=new window.ActiveXObject("WScript.Shell");t&&t.SendKeys("F11")}}var o=document.documentElement;o.requestFullscreen?o.requestFullscreen():o.mozRequestFullScreen?o.mozRequestFullScreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen():o.msRequestFullscreen&&o.msRequestFullscreen()},isFull:function(){return document.fullscreenElement||!1},close:function(){if(this.isFull()){var e=document.exitFullscreen;if(e)e.call(document);else if(window.ActiveXObject){var t=new window.ActiveXObject("WScript.Shell");t&&t.SendKeys("F11")}}var o=document.getElementsByClassName("ysj-imgage-wrapper");o[0].style.display="none"},touchstart:function(e){if("Desktop"!==this.browserRedirect){var t=e.touches;K.start(e),this.state.moving=1===t.length&&1!==this.state.scale,this.state.zooming=2===t.length,Z=this.state.moveX,G=this.state.moveY,q=Date.now(),this.state.zooming&&(W=this.state.scale,U=this.getDistance(e.touches))}},touchmove:function(e){var t=e.touches;K.move(e),(this.state.moving||this.state.zooming)&&L(e,!0);var o=this.config.maxZoom||3;if(this.state.moving){var n=K.deltaX,i=K.deltaY,r=n.value+Z,s=i.value+G,a=Number(o/2*window.innerWidth),c=Number(o/2*window.innerHeight);this.state.moveX=this.clamp(r,-a,a),this.state.moveY=this.clamp(s,-c,c)}if(this.state.zooming&&2===t.length){var l=this.getDistance(t),u=W*l/U;this.state.scale=u<1?u:u>o?o:u}},touchend:function(e){var t=!1;if(this.state.moving||this.state.zooming){t=!0,this.state.moving&&Z===this.state.moveX&&G===this.state.moveY&&(t=!1);var o=this.config.maxZoom||3;if(!e.touches.length){if(this.state.zooming){var n=Number(o/2*window.innerWidth),i=Number(o/2*window.innerHeight);this.state.moveX=this.clamp(this.state.moveX,-n,n),this.state.moveY=this.clamp(this.state.moveY,-i,i),this.state.zooming=!1}this.state.moving=!1,Z=0,G=0,W=1,this.state.scale<1&&this.resetScale()}}else this.checkTap();L(e,t),K.reset()},getDistance:function(e){return Math.sqrt(Math.pow(e[0].clientX-e[1].clientX,2)+Math.pow(e[0].clientY-e[1].clientY,2))},changeSwipe:function(e){this.dataConfig.current=e+1,this.resetScale()},clamp:function(e,t,o){return Math.min(Math.max(e,t),o)},resetScale:function(){this.state.scale=1,this.state.moveX=0,this.state.moveY=0},checkTap:function(){var e=this,t=K.offsetX,o=K.offsetY,n=Date.now()-q,i=250,r=5;t.value<r&&o.value<r&&n<i&&(J?(clearTimeout(J),J=null):J=setTimeout((function(){e.close(),J=null}),i))},zoom:function(e){this.resetImgPositon();var t=this.config.maxZoom||3;if(!(this.zoomRate>=t&&"big"===e)){if("big"===e)this.zoomRate=Number((this.zoomRate+.2).toFixed(1));else{if(this.zoomRate<=.2)return;this.zoomRate=Number((this.zoomRate-.2).toFixed(1))}var o=this.$refs.imgDom,n=this.imgInfo.w*this.zoomRate,i=this.imgInfo.h*this.zoomRate;o&&(o.style.width=n+"px",o.style.height=i+"px"),n>window.innerWidth||i>window.innerHeight?this.isHidden=!0:this.isHidden=!1}},mousedown:function(e){e.preventDefault(),this.isHidden&&(this.imgPosition.startX=e.clientX,this.imgPosition.startY=e.clientY,this.imgPosition.isdown=!0,this.$refs.imgDom.style.cursor="move")},mousemove:function(e){if(this.isHidden&&this.imgPosition.isdown){var t=this.imgPosition,o=t.originX,n=t.originY,i=t.startX,r=t.startY,s=o+e.clientX-i,a=n+e.clientY-r;this.imgPosition.offsetX=s,this.imgPosition.offsetY=a}},mouseup:function(e){e.preventDefault(),this.$refs.imgDom.style.cursor="default",this.imgPosition.isdown=!1,this.imgPosition.originX=this.imgPosition.offsetX,this.imgPosition.originY=this.imgPosition.offsetY},resetImgPositon:function(){this.imgPosition.offsetX=0,this.imgPosition.offsetY=0,this.imgPosition.originX=0,this.imgPosition.originY=0},init:function(){var e=this;window.addEventListener("mousewheel",(function(t){var o=document.getElementsByClassName("ysj-imgage-wrapper");"none"!==o[0].style.display&&(t.wheelDelta>0?e.zoom("big"):e.zoom("small"))}))},dwonload:function(){var e=this.dataConfig.urls[this.dataConfig.current-1];window.open(e,"_blank")}},mounted:function(){this.loadIcon(),this.config&&(this.init(),this.dataConfig=Object.assign({},this.config),"Desktop"===this.browserRedirect&&this.loadImage())}});o("4137");const ee=R()(Q,[["render",N],["__scopeId","data-v-fb7fe6cc"]]);var te,oe=ee,ne=function(e){var t,o=document.getElementsByClassName("ysj-imgage-wrapper");te&&o?(t=o[0],t.style.display="block",te.unmount()):(t=document.createElement("DIV"),t.setAttribute("class","ysj-imgage-wrapper"),document.body.appendChild(t)),te=Object(s["createApp"])(Object(s["h"])(oe,{},e.header),{config:e}),te.component("imgPreview",Object(s["h"])(oe,{config:e},e.header)),te.mount(t)},ie=function(e){ne(e)},re=oe,se={install:function(e){e.config.globalProperties.$previewImage=ie,e.config.globalProperties.$previewImageCom=oe}};t["default"]=se},fb36:function(e,t,o){var n=o("24fb");t=n(!1),t.push([e.i,".ysj-swipe-wrapper[data-v-149e9db8]{position:relative;overflow:hidden;transform:translateZ(0);cursor:-webkit-grab;cursor:grab;height:100%}.ysj-swipe__track[data-v-149e9db8]{display:flex;flex-wrap:nowrap;height:100%;transition-property:transform}",""]),e.exports=t}})}));