3 lines
4.8 KiB
JavaScript
3 lines
4.8 KiB
JavaScript
var __renderjsModules={};
|
|
__renderjsModules.a5d206f8=(()=>{var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of z(t))!F.call(e,i)&&i!==n&&d(e,i,{get:()=>t[i],enumerable:!(r=S(t,i))||r.enumerable});return e};var O=e=>D(d({},"__esModule",{value:!0}),e);var J={};C(J,{default:()=>q});var u={};var h={version:"2.7.11",delayTime:100,errorUpdateKey:"z-paging-error-emit",completeUpdateKey:"z-paging-complete-emit",cachePrefixKey:"z-paging-cache",listCellIndexKey:"zp_index",listCellIndexUniqueKey:"zp_unique_index"};var m="Z-PAGING-REFRESHER-TIME-STORAGE-KEY",c=null,p=!1,f={};function I(e,t){return()=>{if(H(),!c)return t;let n=c[e];return n===void 0?t:n}}function Y(e){let t=null;if(e.touches&&e.touches.length)t=e.touches[0];else if(e.changedTouches&&e.changedTouches.length)t=e.changedTouches[0];else if(e.datail&&e.datail!={})t=e.datail;else return{touchX:0,touchY:0};return{touchX:t.clientX,touchY:t.clientY}}function T(e){if(e&&e.tagName&&e.tagName!=="BODY"&&e.tagName!=="UNI-PAGE-BODY"){let t=e.classList;return t&&t.contains("z-paging-content")?{isFromZp:!0,isPageScroll:t.contains("z-paging-content-page"),isReachedTop:t.contains("z-paging-reached-top"),isUseChatRecordMode:t.contains("z-paging-use-chat-record-mode")}:T(e.parentNode)}else return{isFromZp:!1}}function y(e){return e?e.$refs.paging?e:y(e.$parent):null}function v(e){console.error(`[z-paging]${e}`)}function E(e,t=h.delayTime,n){let r=setTimeout(e,t);return n&&(f[n]&&clearTimeout(f[n]),f[n]=r),r}function b(e,t){let n=w()||{};n[t]=e,uni.setStorageSync(m,n)}function w(){return uni.getStorageSync(m)}function L(e){let t=w();return t&&t[e]?t[e]:null}function A(e,t){let n=L(e),r=n?j(n,t):t.none;return`${t.title}${r}`}function N(e){if(Object.prototype.toString.call(e)==="[object Number]")return e;let n=!1;return e.indexOf("rpx")!==-1||e.indexOf("upx")!==-1?(e=e.replace("rpx","").replace("upx",""),n=!0):e.indexOf("px")!==-1&&(e=e.replace("px","")),isNaN(e)?0:Number(n?uni.upx2px(e):e)}function x(){return new Date().getTime()}function U(){let e=[],t="0123456789abcdef";for(let n=0;n<10;n++)e[n]=t.substr(Math.floor(Math.random()*16),1);return e.join("")+x()}function Z(e){return new Promise(t=>{setTimeout(t,e)})}function K(e){return Object.prototype.toString.call(e)==="[object Promise]"}function M(e,t){if(Object.prototype.toString.call(e)==="[object String]"){let n=e;n=n.replace("rpx","").replace("upx","").replace("px",""),e.indexOf("rpx")===-1&&e.indexOf("upx")===-1&&e.indexOf("px")!==-1&&(n=parseFloat(n)*2),e=n}return t==="rpx"?e+"rpx":e/2+"px"}function P(e){if(typeof e!="object"||e===null)return e;let t=Array.isArray(e)?[]:{};for(let n in e)e.hasOwnProperty(n)&&(t[n]=P(e[n]));return t}function H(){p||(u&&Object.keys(u).length&&(c=u),!c&&uni.$zp&&(c=uni.$zp.config),c=c?Object.keys(c).reduce((e,t)=>(e[X(t)]=c[t],e),{}):null,p=!0)}function j(e,t){let n=new Date(e),r=new Date,i=new Date(e).setHours(0,0,0,0),$=new Date().setHours(0,0,0,0),g=i-$,s="",_=G(n);return g===0?s=t.today:g===-864e5?s=t.yesterday:s=B(n,n.getFullYear()!==r.getFullYear()),`${s} ${_}`}function B(e,t=!0){let n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate();return t?`${n}-${a(r)}-${a(i)}`:`${a(r)}-${a(i)}`}function G(e){let t=e.getHours(),n=e.getMinutes();return`${a(t)}:${a(n)}`}function a(e){return e=e.toString(),e.length===1?"0"+e:e}function X(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}var l={gc:I,setRefesrherTime:b,getRefesrherFormatTimeByKey:A,getTouch:Y,getTouchFromZPaging:T,getParent:y,convertToPx:N,getTime:x,getInstanceId:U,consoleErr:v,delay:E,wait:Z,isPromise:K,addUnit:M,deepCopy:P};var o={startY:0,isTouchFromZPaging:!1,isUsePageScroll:!1,isReachedTop:!0,isIosAndH5:!1,useChatRecordMode:!1,appLaunched:!1},R={mounted(){window&&(this._handleTouch(),this.$ownerInstance.callMethod("_handlePageLaunch"))},methods:{renderPropIsIosAndH5Change(e){e!==-1&&(o.isIosAndH5=e)},_handleTouch(){window.$zPagingRenderJsInited||(window.$zPagingRenderJsInited=!0,window.addEventListener("touchstart",this._handleTouchstart,{passive:!0}),window.addEventListener("touchmove",this._handleTouchmove,{passive:!1}))},_handleTouchstart(e){let t=l.getTouch(e);o.startY=t.touchY;let n=l.getTouchFromZPaging(e.target);o.isTouchFromZPaging=n.isFromZp,o.isUsePageScroll=n.isPageScroll,o.isReachedTop=n.isReachedTop,o.useChatRecordMode=n.isUseChatRecordMode},_handleTouchmove(e){let n=l.getTouch(e).touchY-o.startY;o.isTouchFromZPaging&&(o.isReachedTop&&(o.useChatRecordMode?n<0:n>0)||!o.useChatRecordMode&&o.isIosAndH5&&!o.isUsePageScroll&&n<0)&&e.cancelable&&!e.defaultPrevented&&e.preventDefault()},_removeAllEventListener(){window.removeEventListener("touchstart"),window.removeEventListener("touchmove")}}};var q={name:"z-paging",mixins:[R]};return O(J);})();
|