UNPKG

vue-cobweb-app-v3

Version:

移动端-项目开发通用组件库-带使用文档

2 lines (1 loc) 11.6 kB
(function(b,$){typeof exports=="object"&&typeof module!="undefined"?module.exports=$():typeof define=="function"&&define.amd?define($):(b=typeof globalThis!="undefined"?globalThis:b||self,b.vueCobwebApp=$())})(this,function(){"use strict";function b(e){if(d(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],i=_(s)?$e(s):b(s);if(i)for(const r in i)t[r]=i[r]}return t}else{if(_(e))return e;if(w(e))return e}}const $=/;(?![^(]*\))/g,je=/:(.+)/;function $e(e){const t={};return e.split($).forEach(n=>{if(n){const s=n.split(je);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function X(e){let t="";if(_(e))t=e;else if(d(e))for(let n=0;n<e.length;n++){const s=X(e[n]);s&&(t+=s+" ")}else if(w(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Ae={},Be=[],le=()=>{},ze=/^on[^a-z]/,De=e=>ze.test(e),C=Object.assign,qe=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Array.isArray,He=e=>Z(e)==="[object Map]",Ue=e=>Z(e)==="[object Set]",a=e=>typeof e=="function",_=e=>typeof e=="string",Je=e=>typeof e=="symbol",w=e=>e!==null&&typeof e=="object",We=e=>w(e)&&a(e.then)&&a(e.catch),Le=Object.prototype.toString,Z=e=>Le.call(e),Ye=e=>Z(e)==="[object Object]",ce=(e,t)=>!Object.is(e,t),Ge=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})};let Ke;function Xe(e,t=Ke){t&&t.active&&t.effects.push(e)}const Ze=e=>(e.w&S)>0,Qe=e=>(e.n&S)>0,ve=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=S},et=e=>{const{deps:t}=e;if(t.length){let n=0;for(let s=0;s<t.length;s++){const i=t[s];Ze(i)&&!Qe(i)?i.delete(e):t[n++]=i,i.w&=~S,i.n&=~S}t.length=n}};let H=0,S=1;const ue=30;let U;class tt{constructor(t,n=null,s){this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,Xe(this,s)}run(){if(!this.active)return this.fn();let t=U,n=Q;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=U,U=this,Q=!0,S=1<<++H,H<=ue?ve(this):fe(this),this.fn()}finally{H<=ue&&et(this),S=1<<--H,U=this.parent,Q=n,this.parent=void 0}}stop(){this.active&&(fe(this),this.onStop&&this.onStop(),this.active=!1)}}function fe(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let Q=!0;new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(Je));function O(e){return ae(e)?O(e.__v_raw):!!(e&&e.__v_isReactive)}function ae(e){return!!(e&&e.__v_isReadonly)}function nt(e){return!!(e&&e.__v_isShallow)}function de(e){return O(e)||ae(e)}function st(e){return Ge(e,"__v_skip",!0),e}function x(e){return!!(e&&e.__v_isRef===!0)}function it(e){return x(e)?e.value:e}const rt={get:(e,t,n)=>it(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const i=e[t];return x(i)&&!x(n)?(i.value=n,!0):Reflect.set(e,t,n,s)}};function ot(e){return O(e)?e:new Proxy(e,rt)}Promise.resolve();function P(e,t,n,s){let i;try{i=s?e(...s):e()}catch(r){pe(r,t,n)}return i}function v(e,t,n,s){if(a(e)){const r=P(e,t,n,s);return r&&We(r)&&r.catch(l=>{pe(l,t,n)}),r}const i=[];for(let r=0;r<e.length;r++)i.push(v(e[r],t,n,s));return i}function pe(e,t,n,s=!0){const i=t?t.vnode:null;if(t){let r=t.parent;const l=t.proxy,o=n;for(;r;){const g=r.ec;if(g){for(let F=0;F<g.length;F++)if(g[F](e,l,o)===!1)return}r=r.parent}const c=t.appContext.config.errorHandler;if(c){P(c,null,10,[e,l,o]);return}}lt(e,n,i,s)}function lt(e,t,n,s=!0){console.error(e)}let J=!1,ee=!1;const p=[];let m=0;const A=[];let B=null,E=0;const z=[];let y=null,T=0;const he=Promise.resolve();let te=null,ne=null;function ct(e){const t=te||he;return e?t.then(this?e.bind(this):e):t}function ut(e){let t=m+1,n=p.length;for(;t<n;){const s=t+n>>>1;D(p[s])<e?t=s+1:n=s}return t}function ft(e){(!p.length||!p.includes(e,J&&e.allowRecurse?m+1:m))&&e!==ne&&(e.id==null?p.push(e):p.splice(ut(e.id),0,e),ge())}function ge(){!J&&!ee&&(ee=!0,te=he.then(ye))}function _e(e,t,n,s){d(e)?n.push(...e):(!t||!t.includes(e,e.allowRecurse?s+1:s))&&n.push(e),ge()}function at(e){_e(e,B,A,E)}function dt(e){_e(e,y,z,T)}function me(e,t=null){if(A.length){for(ne=t,B=[...new Set(A)],A.length=0,E=0;E<B.length;E++)B[E]();B=null,E=0,ne=null,me(e,t)}}function pt(e){if(z.length){const t=[...new Set(z)];if(z.length=0,y){y.push(...t);return}for(y=t,y.sort((n,s)=>D(n)-D(s)),T=0;T<y.length;T++)y[T]();y=null,T=0}}const D=e=>e.id==null?1/0:e.id;function ye(e){ee=!1,J=!0,me(e),p.sort((n,s)=>D(n)-D(s));const t=le;try{for(m=0;m<p.length;m++){const n=p[m];n&&n.active!==!1&&P(n,null,14)}}finally{m=0,p.length=0,pt(),J=!1,te=null,(p.length||A.length||z.length)&&ye(e)}}let R=null,ht=null;const gt=e=>e.__isSuspense;function _t(e,t){t&&t.pendingBranch?d(e)?t.effects.push(...e):t.effects.push(e):dt(e)}const be={};function mt(e,t,{immediate:n,deep:s,flush:i,onTrack:r,onTrigger:l}=Ae){const o=V;let c,g=!1,F=!1;if(x(e)?(c=()=>e.value,g=nt(e)):O(e)?(c=()=>e,s=!0):d(e)?(F=!0,g=e.some(O),c=()=>e.map(f=>{if(x(f))return f.value;if(O(f))return N(f);if(a(f))return P(f,o,2)})):a(e)?t?c=()=>P(e,o,2):c=()=>{if(!(o&&o.isUnmounted))return q&&q(),v(e,o,3,[Me])}:c=le,t&&s){const f=c;c=()=>N(f())}let q,Me=f=>{q=h.onStop=()=>{P(f,o,4)}},M=F?[]:be;const j=()=>{if(!!h.active)if(t){const f=h.run();(s||g||(F?f.some((Ut,Jt)=>ce(Ut,M[Jt])):ce(f,M)))&&(q&&q(),v(t,o,3,[f,M===be?void 0:M,Me]),M=f)}else h.run()};j.allowRecurse=!!t;let K;i==="sync"?K=j:i==="post"?K=()=>xe(j,o&&o.suspense):K=()=>{!o||o.isMounted?at(j):j()};const h=new tt(c,K);return t?n?j():M=h.run():i==="post"?xe(h.run.bind(h),o&&o.suspense):h.run(),()=>{h.stop(),o&&o.scope&&qe(o.scope.effects,h)}}function yt(e,t,n){const s=this.proxy,i=_(e)?e.includes(".")?bt(s,e):()=>s[e]:e.bind(s,s);let r;a(t)?r=t:(r=t.handler,n=t);const l=V;Ne(this);const o=mt(i,r.bind(s),n);return l?Ne(l):$t(),o}function bt(e,t){const n=t.split(".");return()=>{let s=e;for(let i=0;i<n.length&&s;i++)s=s[n[i]];return s}}function N(e,t){if(!w(e)||e.__v_skip||(t=t||new Set,t.has(e)))return e;if(t.add(e),x(e))N(e.value,t);else if(d(e))for(let n=0;n<e.length;n++)N(e[n],t);else if(Ue(e)||He(e))e.forEach(n=>{N(n,t)});else if(Ye(e))for(const n in e)N(e[n],t);return e}function Ct(e){return a(e)?{setup:e,name:e.name}:e}function St(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:i,optionsCache:r,config:{optionMergeStrategies:l}}=e.appContext,o=r.get(t);let c;return o?c=o:!i.length&&!n&&!s?c=t:(c={},i.length&&i.forEach(g=>W(c,g,l,!0)),W(c,t,l)),r.set(t,c),c}function W(e,t,n,s=!1){const{mixins:i,extends:r}=t;r&&W(e,r,n,!0),i&&i.forEach(l=>W(e,l,n,!0));for(const l in t)if(!(s&&l==="expose")){const o=xt[l]||n&&n[l];e[l]=o?o(e[l],t[l]):t[l]}return e}const xt={data:Ce,props:k,emits:k,methods:k,computed:k,beforeCreate:u,created:u,beforeMount:u,mounted:u,beforeUpdate:u,updated:u,beforeDestroy:u,beforeUnmount:u,destroyed:u,unmounted:u,activated:u,deactivated:u,errorCaptured:u,serverPrefetch:u,components:k,directives:k,watch:It,provide:Ce,inject:kt};function Ce(e,t){return t?e?function(){return C(a(e)?e.call(this,this):e,a(t)?t.call(this,this):t)}:t:e}function kt(e,t){return k(Se(e),Se(t))}function Se(e){if(d(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function u(e,t){return e?[...new Set([].concat(e,t))]:t}function k(e,t){return e?C(C(Object.create(null),e),t):t}function It(e,t){if(!e)return t;if(!t)return e;const n=C(Object.create(null),e);for(const s in t)n[s]=u(e[s],t[s]);return n}const xe=_t,Ft=e=>e.__isTeleport,wt=Symbol(),L=Symbol(void 0),Ot=Symbol(void 0),ke=Symbol(void 0),Y=[];let I=null;function Ie(e=!1){Y.push(I=e?null:[])}function Pt(){Y.pop(),I=Y[Y.length-1]||null}function Fe(e){return e.dynamicChildren=I||Be,Pt(),I&&I.push(e),e}function Et(e,t,n,s,i,r){return Fe(Ee(e,t,n,s,i,r,!0))}function Tt(e,t,n,s,i){return Fe(se(e,t,n,s,i,!0))}function we(e){return e?e.__v_isVNode===!0:!1}const Oe="__vInternal",Pe=({key:e})=>e!=null?e:null,G=({ref:e,ref_key:t,ref_for:n})=>e!=null?_(e)||x(e)||a(e)?{i:R,r:e,k:t,f:!!n}:e:null;function Ee(e,t=null,n=null,s=0,i=null,r=e===L?0:1,l=!1,o=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Pe(t),ref:t&&G(t),scopeId:ht,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:s,dynamicProps:i,dynamicChildren:null,appContext:null};return o?(re(c,n),r&128&&e.normalize(c)):n&&(c.shapeFlag|=_(n)?8:16),!l&&I&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&I.push(c),c}const se=Rt;function Rt(e,t=null,n=null,s=0,i=null,r=!1){if((!e||e===wt)&&(e=ke),we(e)){const o=ie(e,t,!0);return n&&re(o,n),o}if(zt(e)&&(e=e.__vccOpts),t){t=Nt(t);let{class:o,style:c}=t;o&&!_(o)&&(t.class=X(o)),w(c)&&(de(c)&&!d(c)&&(c=C({},c)),t.style=b(c))}const l=_(e)?1:gt(e)?128:Ft(e)?64:w(e)?4:a(e)?2:0;return Ee(e,t,n,s,i,l,r,!0)}function Nt(e){return e?de(e)||Oe in e?C({},e):e:null}function ie(e,t,n=!1){const{props:s,ref:i,patchFlag:r,children:l}=e,o=t?Mt(s||{},t):s;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:o,key:o&&Pe(o),ref:t&&t.ref?n&&i?d(i)?i.concat(G(t)):[i,G(t)]:G(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==L?r===-1?16:r|16:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ie(e.ssContent),ssFallback:e.ssFallback&&ie(e.ssFallback),el:e.el,anchor:e.anchor}}function Vt(e=" ",t=0){return se(Ot,null,e,t)}function re(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(d(t))n=16;else if(typeof t=="object")if(s&65){const i=t.default;i&&(i._c&&(i._d=!1),re(e,i()),i._c&&(i._d=!0));return}else{n=32;const i=t._;!i&&!(Oe in t)?t._ctx=R:i===3&&R&&(R.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else a(t)?(t={default:t,_ctx:R},n=32):(t=String(t),s&64?(n=16,t=[Vt(t)]):n=8);e.children=t,e.shapeFlag|=n}function Mt(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const i in s)if(i==="class")t.class!==s.class&&(t.class=X([t.class,s.class]));else if(i==="style")t.style=b([t.style,s.style]);else if(De(i)){const r=t[i],l=s[i];l&&r!==l&&!(d(r)&&r.includes(l))&&(t[i]=r?[].concat(r,l):l)}else i!==""&&(t[i]=s[i])}return t}function jt(e,t,n={},s,i){if(R.isCE)return se("slot",t==="default"?null:{name:t},s&&s());let r=e[t];r&&r._c&&(r._d=!1),Ie();const l=r&&Te(r(n)),o=Tt(L,{key:n.key||`_${t}`},l||(s?s():[]),l&&e._===1?64:-2);return!i&&o.scopeId&&(o.slotScopeIds=[o.scopeId+"-s"]),r&&r._c&&(r._d=!0),o}function Te(e){return e.some(t=>we(t)?!(t.type===ke||t.type===L&&!Te(t.children)):!0)?e:null}const oe=e=>e?At(e)?Bt(e)||e.proxy:oe(e.parent):null,Re=C(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>oe(e.parent),$root:e=>oe(e.root),$emit:e=>e.emit,$options:e=>St(e),$forceUpdate:e=>()=>ft(e.update),$nextTick:e=>ct.bind(e.proxy),$watch:e=>yt.bind(e)});let V=null;const Ne=e=>{V=e,e.scope.on()},$t=()=>{V&&V.scope.off(),V=null};function At(e){return e.vnode.shapeFlag&4}function Bt(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(ot(st(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Re)return Re[n](e)}}))}function zt(e){return a(e)&&"__vccOpts"in e}var Wt="",Dt=(e,t)=>{const n=e.__vccOpts||e;for(const[s,i]of t)n[s]=i;return n},qt=Dt(Ct({emits:["click"],setup(e){return(t,n)=>(Ie(),Et("button",{class:"my-button",onClick:n[0]||(n[0]=s=>t.$emit("click",s))},[jt(t.$slots,"default",{},void 0,!0)]))}}),[["__scopeId","data-v-0bca6aff"]]);const Ve=e=>{e.component("my-button",qt)};typeof window!="undefined"&&window.Vue&&Ve(window.Vue);var Ht={install:Ve};return Ht});