mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
/*! For license information please see 8977.02b1f4bf.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["8977"],{73550:function(e,o,n){"use strict";n.r(o);let t=n("64704").Z;o.default=t},64704:function(e,o,n){"use strict";var t=n("80681"),r=n("11848"),i=n("40537"),l=n("7197"),a=n("54369"),u=n("13118");o.Z={__name:"index",setup(e){let o=(0,a.q)({"zh-CN":{penColor:"\u81EA\u5B9A\u4E49\u989C\u8272",lineWidth:"\u81EA\u5B9A\u4E49\u7EBF\u5BBD",backgroundColor:"\u81EA\u5B9A\u4E49\u80CC\u666F\u989C\u8272"},"en-US":{penColor:"Pen Color",lineWidth:"Line Width",backgroundColor:"Background Color"}}),n=(0,r.iH)(""),c=e=>{n.value=e.image},s=()=>(0,u.CF)("clear");return(e,a)=>{let u=(0,t.up)("demo-block");return(0,t.wg)(),(0,t.iD)(t.HY,null,[(0,t.Wm)(u,{title:(0,r.SU)(o)("basicUsage")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,r.SU)(i.Z),{onSubmit:c,onClear:s})]),_:1},8,["title"]),n.value?((0,t.wg)(),(0,t.j4)((0,r.SU)(l.ZP),{key:0,src:n.value},null,8,["src"])):(0,t.kq)("",!0),(0,t.Wm)(u,{title:(0,r.SU)(o)("penColor")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,r.SU)(i.Z),{"pen-color":"#ff0000",onClear:s,onSubmit:c})]),_:1},8,["title"]),(0,t.Wm)(u,{title:(0,r.SU)(o)("lineWidth")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,r.SU)(i.Z),{"line-width":6,onClear:s,onSubmit:c})]),_:1},8,["title"]),(0,t.Wm)(u,{title:(0,r.SU)(o)("backgroundColor")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,r.SU)(i.Z),{"background-color":"#eee",onClear:s,onSubmit:c})]),_:1},8,["title"])],64)}}}},99497:function(e,o,n){"use strict";n.d(o,{zx:function(){return i}});var t=n("63112"),r=n("14314"),i=(0,t.n)(r.Z);o.ZP=i},6149:function(e,o,n){"use strict";n.d(o,{BC:function(){return i},g2:function(){return r},yj:function(){return l}}),n("56115"),n("59644");var t=n("80681"),r={to:[String,Object],url:String,replace:Boolean};function i(e){var{to:o,url:n,replace:t,$router:r}=e;o&&r?r[t?"replace":"push"](o):n&&(t?location.replace(n):location.href=n)}function l(){var e=(0,t.FN)().proxy;return()=>i(e)}},7197:function(e,o,n){"use strict";n.d(o,{Ee:function(){return i}});var t=n("63112"),r=n("46858"),i=(0,t.n)(r.Z);o.ZP=i},95786:function(e,o,n){"use strict";n.d(o,{gb:function(){return i}});var t=n("63112"),r=n("2309"),i=(0,t.n)(r.Z);o.ZP=i},40537:function(e,o,n){"use strict";var t=n("63112"),r=n("68421"),i=(0,t.n)(r.Z);o.Z=i},20897:function(e,o,n){"use strict";n.d(o,{G:function(){return r}});var t=0;function r(e){e?(!t&&document.body.classList.add("van-toast--unclickable"),t++):t&&!--t&&document.body.classList.remove("van-toast--unclickable")}},84285:function(e,o,n){"use strict";n.d(o,{H:function(){return u},o:function(){return a}});var t=n("11848"),r=n("39594"),i=n("12308"),l=n("10023");function a(){var e=(0,t.qj)({show:!1}),o=o=>{e.show=o},n=n=>{(0,i.l7)(e,n,{transitionAppear:!0}),o(!0)},r=()=>o(!1);return(0,l.F)({open:n,close:r,toggle:o}),{open:n,close:r,state:e,toggle:o}}function u(e){var o=(0,r.ri)(e),n=document.createElement("div");return document.body.appendChild(n),{instance:o.mount(n),unmount(){o.unmount(),document.body.removeChild(n)}}}},14314:function(e,o,n){"use strict";n("82116"),n("17989"),n("24660");var t=n("80681"),r=n("62568"),i=n("12308"),l=n("78335"),a=n("82210"),u=n("8051"),c=n("6149"),s=n("96528"),d=n("95786"),[v,g]=(0,r.do)("button"),f=(0,i.l7)({},c.g2,{tag:(0,l.SQ)("button"),text:String,icon:String,type:(0,l.SQ)("default"),size:(0,l.SQ)("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:(0,l.SQ)("button"),loadingSize:l.Or,loadingText:String,loadingType:String,iconPosition:(0,l.SQ)("left")});o.Z=(0,t.aZ)({name:v,props:f,emits:["click"],setup(e,o){var{emit:n,slots:r}=o,i=(0,c.yj)(),l=()=>r.loading?r.loading():(0,t.Wm)(d.gb,{size:e.loadingSize,type:e.loadingType,class:g("loading")},null),v=()=>e.loading?l():r.icon?(0,t.Wm)("div",{class:g("icon")},[r.icon()]):e.icon?(0,t.Wm)(s.JO,{name:e.icon,class:g("icon"),classPrefix:e.iconPrefix},null):void 0,f=()=>{var o;if(o=e.loading?e.loadingText:r.default?r.default():e.text)return(0,t.Wm)("span",{class:g("text")},[o])},m=()=>{var{color:o,plain:n}=e;if(o){var t={color:n?o:"white"};return!n&&(t.background=o),o.includes("gradient")?t.border=0:t.borderColor=o,t}},p=o=>{e.loading?(0,a.PF)(o):!e.disabled&&(n("click",o),i())};return()=>{var{tag:o,type:n,size:r,block:i,round:l,plain:a,square:c,loading:s,disabled:d,hairline:h,nativeType:S,iconPosition:y}=e,b=[g([n,r,{plain:a,block:i,round:l,square:c,loading:s,disabled:d,hairline:h}]),{[u._K]:h}];return(0,t.Wm)(o,{type:S,class:b,style:m(),disabled:d,onClick:p},{default:()=>[(0,t.Wm)("div",{class:g("content")},["left"===y&&v(),f(),"right"===y&&v()])]})}}})},46858:function(e,o,n){"use strict";n("82116"),n("17989");var t=n("80681"),r=n("11848"),i=n("62568"),l=n("78335"),a=n("20358"),u=n("12308"),c=n("96528"),[s,d]=(0,i.do)("image"),v={src:String,alt:String,fit:String,position:String,round:Boolean,block:Boolean,width:l.Or,height:l.Or,radius:l.Or,lazyLoad:Boolean,iconSize:l.Or,showError:l.J5,errorIcon:(0,l.SQ)("photo-fail"),iconPrefix:String,showLoading:l.J5,loadingIcon:(0,l.SQ)("photo"),crossorigin:String,referrerpolicy:String};o.Z=(0,t.aZ)({name:s,props:v,emits:["load","error"],setup(e,o){var{emit:n,slots:i}=o,l=(0,r.iH)(!1),s=(0,r.iH)(!0),v=(0,r.iH)(),{$Lazyload:g}=(0,t.FN)().proxy,f=(0,t.Fl)(()=>{var o={width:(0,a.Nn)(e.width),height:(0,a.Nn)(e.height)};return(0,u.Xq)(e.radius)&&(o.overflow="hidden",o.borderRadius=(0,a.Nn)(e.radius)),o});(0,t.YP)(()=>e.src,()=>{l.value=!1,s.value=!0});var m=e=>{s.value&&(s.value=!1,n("load",e))},p=()=>{var e=new Event("load");Object.defineProperty(e,"target",{value:v.value,enumerable:!0}),m(e)},h=e=>{l.value=!0,s.value=!1,n("error",e)},S=(o,n,r)=>r?r():(0,t.Wm)(c.JO,{name:o,size:e.iconSize,class:n,classPrefix:e.iconPrefix},null),y=()=>s.value&&e.showLoading?(0,t.Wm)("div",{class:d("loading")},[S(e.loadingIcon,d("loading-icon"),i.loading)]):l.value&&e.showError?(0,t.Wm)("div",{class:d("error")},[S(e.errorIcon,d("error-icon"),i.error)]):void 0,b=()=>{if(!l.value&&e.src){var o={alt:e.alt,class:d("img"),style:{objectFit:e.fit,objectPosition:e.position},crossorigin:e.crossorigin,referrerpolicy:e.referrerpolicy};return e.lazyLoad?(0,t.wy)((0,t.Wm)("img",(0,t.dG)({ref:v},o),null),[[(0,t.Q2)("lazy"),e.src]]):(0,t.Wm)("img",(0,t.dG)({ref:v,src:e.src,onLoad:m,onError:h},o),null)}},C=e=>{var{el:o}=e,n=()=>{o===v.value&&s.value&&p()};v.value?n():(0,t.Y3)(n)},W=e=>{var{el:o}=e;o===v.value&&!l.value&&h()};return g&&u._f&&(g.$on("loaded",C),g.$on("error",W),(0,t.Jd)(()=>{g.$off("loaded",C),g.$off("error",W)})),(0,t.bv)(()=>{(0,t.Y3)(()=>{var o;(null===(o=v.value)||void 0===o?void 0:o.complete)&&!e.lazyLoad&&p()})}),()=>{var o;return(0,t.Wm)("div",{class:d({round:e.round,block:e.block}),style:f.value},[b(),y(),null===(o=i.default)||void 0===o?void 0:o.call(i)])}}})},2309:function(e,o,n){"use strict";n("82116"),n("17989"),n("66786"),n("14529");var t=n("80681"),r=n("62568"),i=n("78335"),l=n("12308"),a=n("20358"),[u,c]=(0,r.do)("loading"),s=Array(12).fill(null).map((e,o)=>(0,t.Wm)("i",{class:c("line",String(o+1))},null)),d=(0,t.Wm)("svg",{class:c("circular"),viewBox:"25 25 50 50"},[(0,t.Wm)("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),v={size:i.Or,type:(0,i.SQ)("circular"),color:String,vertical:Boolean,textSize:i.Or,textColor:String};o.Z=(0,t.aZ)({name:u,props:v,setup(e,o){var{slots:n}=o,r=(0,t.Fl)(()=>(0,l.l7)({color:e.color},(0,a.Xn)(e.size))),i=()=>{var o="spinner"===e.type?s:d;return(0,t.Wm)("span",{class:c("spinner",e.type),style:r.value},[n.icon?n.icon():o])},u=()=>{if(n.default){var o;return(0,t.Wm)("span",{class:c("text"),style:{fontSize:(0,a.Nn)(e.textSize),color:null!==(o=e.textColor)&&void 0!==o?o:e.color}},[n.default()])}};return()=>{var{type:o,vertical:n}=e;return(0,t.Wm)("div",{class:c([o,{vertical:n}]),"aria-live":"polite","aria-busy":!0},[i(),u()])}}})},68421:function(e,o,n){"use strict";n("82116"),n("17989");var t=n("80681"),r=n("11848"),i=n("62568"),l=n("78335"),a=n("12308"),u=n("82210"),c=n("22300"),s=n("10023"),d=n("99497"),[v,g,f]=(0,i.do)("signature"),m={tips:String,type:(0,l.SQ)("png"),penColor:(0,l.SQ)("#000"),lineWidth:(0,l.qM)(3),clearButtonText:String,backgroundColor:(0,l.SQ)(""),confirmButtonText:String},p=()=>{var e,o=document.createElement("canvas");return!!(null===(e=o.getContext)||void 0===e?void 0:e.call(o,"2d"))};o.Z=(0,t.aZ)({name:v,props:m,emits:["submit","clear","start","end","signing"],setup(e,o){var n,{emit:i}=o,l=(0,r.iH)(),v=(0,r.iH)(),m=(0,t.Fl)(()=>l.value?l.value.getContext("2d"):null),h=!a._f||p(),S=0,y=0,b=()=>{if(!m.value)return!1;m.value.beginPath(),m.value.lineWidth=e.lineWidth,m.value.strokeStyle=e.penColor,n=(0,c.EL)(l),i("start")},C=e=>{if(!m.value)return!1;(0,u.PF)(e);var o=e.touches[0],t=o.clientX-((null==n?void 0:n.left)||0),r=o.clientY-((null==n?void 0:n.top)||0);m.value.lineCap="round",m.value.lineJoin="round",m.value.lineTo(t,r),m.value.stroke(),i("signing",e)},W=e=>{(0,u.PF)(e),i("end")},k=o=>{var n=document.createElement("canvas");return n.width=o.width,n.height=o.height,e.backgroundColor&&w(n.getContext("2d")),o.toDataURL()===n.toDataURL()},w=o=>{o&&e.backgroundColor&&(o.fillStyle=e.backgroundColor,o.fillRect(0,0,S,y))},x=()=>{var o,n,t=l.value;t&&i("submit",{image:k(t)?"":(null===(o=(n={jpg:()=>t.toDataURL("image/jpeg",.8),jpeg:()=>t.toDataURL("image/jpeg",.8)})[e.type])||void 0===o?void 0:o.call(n))||t.toDataURL("image/".concat(e.type)),canvas:t})},P=()=>{m.value&&(m.value.clearRect(0,0,S,y),m.value.closePath(),w(m.value)),i("clear")},z=()=>{if(h&&l.value){var e,o,n,t=l.value,r=a._f?window.devicePixelRatio:1;S=t.width=((null===(e=v.value)||void 0===e?void 0:e.offsetWidth)||0)*r,y=t.height=((null===(o=v.value)||void 0===o?void 0:o.offsetHeight)||0)*r,null===(n=m.value)||void 0===n||n.scale(r,r),w(m.value)}},B=()=>{if(m.value){var e=m.value.getImageData(0,0,S,y);z(),m.value.putImageData(e,0,0)}};return(0,t.YP)(u.bn,B),(0,t.bv)(z),(0,s.F)({resize:B,clear:P,submit:x}),()=>(0,t.Wm)("div",{class:g()},[(0,t.Wm)("div",{class:g("content"),ref:v},[h?(0,t.Wm)("canvas",{ref:l,onTouchstartPassive:b,onTouchmove:C,onTouchend:W},null):(0,t.Wm)("p",null,[e.tips])]),(0,t.Wm)("div",{class:g("footer")},[(0,t.Wm)(d.zx,{size:"small",onClick:P},{default:()=>[e.clearButtonText||f("clear")]}),(0,t.Wm)(d.zx,{type:"primary",size:"small",onClick:x},{default:()=>[e.confirmButtonText||f("confirm")]})])])}})},21083:function(e,o,n){"use strict";n("82116"),n("17989");var t=n("80681"),r=n("62568"),i=n("78335"),l=n("12308"),a=n("20897"),u=n("96528"),c=n("97760"),s=n("95786"),[d,v]=(0,r.do)("toast"),g=["show","overlay","teleport","transition","overlayClass","overlayStyle","closeOnClickOverlay","zIndex"],f={icon:String,show:Boolean,type:(0,i.SQ)("text"),overlay:Boolean,message:i.Or,iconSize:i.Or,duration:(0,i.qM)(2e3),position:(0,i.SQ)("middle"),teleport:[String,Object],wordBreak:String,className:i.Vg,iconPrefix:String,transition:(0,i.SQ)("van-fade"),loadingType:String,forbidClick:Boolean,overlayClass:i.Vg,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,zIndex:i.Or};o.Z=(0,t.aZ)({name:d,props:f,emits:["update:show"],setup(e,o){var n,{emit:r,slots:i}=o,d=!1,f=()=>{var o=e.show&&e.forbidClick;d!==o&&(d=o,(0,a.G)(d))},m=e=>r("update:show",e),p=()=>{e.closeOnClick&&m(!1)},h=()=>clearTimeout(n),S=()=>{var{icon:o,type:n,iconSize:r,iconPrefix:i,loadingType:l}=e;return o||"success"===n||"fail"===n?(0,t.Wm)(u.JO,{name:o||n,size:r,class:v("icon"),classPrefix:i},null):"loading"===n?(0,t.Wm)(s.gb,{class:v("loading"),size:r,type:l},null):void 0},y=()=>{var{type:o,message:n}=e;return i.message?(0,t.Wm)("div",{class:v("text")},[i.message()]):(0,l.Xq)(n)&&""!==n?"html"===o?(0,t.Wm)("div",{key:0,class:v("text"),innerHTML:String(n)},null):(0,t.Wm)("div",{class:v("text")},[n]):void 0};return(0,t.YP)(()=>[e.show,e.forbidClick],f),(0,t.YP)(()=>[e.show,e.type,e.message,e.duration],()=>{h(),e.show&&e.duration>0&&(n=setTimeout(()=>{m(!1)},e.duration))}),(0,t.bv)(f),(0,t.Ah)(f),()=>(0,t.Wm)(c.GI,(0,t.dG)({class:[v([e.position,"normal"===e.wordBreak?"break-normal":e.wordBreak,{[e.type]:!e.icon}]),e.className],lockScroll:!1,onClick:p,onClosed:h,"onUpdate:show":m},(0,l.ei)(e,g)),{default:()=>[S(),y()]})}})},13118:function(e,o,n){"use strict";n.d(o,{CF:function(){return v},LJ:function(){return p},XA:function(){return m},di:function(){return f},yg:function(){return h}}),n("24836"),n("41712"),n("80855"),n("10502"),n("7978"),n("66746"),n("17530"),n("87604"),n("57024"),n("22175"),n("85322"),n("47897"),n("48943"),n("43356"),n("82116"),n("17989"),n("96245"),n("37232"),n("70629"),n("61557"),n("31564"),n("8649");var t=n("80681"),r=n("11848"),i=n("12308"),l=n("84285"),a=n("21083"),u=[],c=(0,i.l7)({},{icon:"",type:"text",message:"",className:"",overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:"body",iconSize:void 0,iconPrefix:void 0,position:"middle",transition:"van-fade",forbidClick:!1,loadingType:void 0,overlayClass:"",overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1}),s=new Map;function d(e){return(0,i.Kn)(e)?e:{message:e}}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!i._f)return{};var o=function(){if(!u.length){var e=function(){var{instance:e,unmount:o}=(0,l.H)({setup(){var e=(0,r.iH)(""),{open:o,state:n,close:i,toggle:u}=(0,l.o)(),c=()=>{};return(0,t.YP)(e,e=>{n.message=e}),(0,t.FN)().render=()=>(0,t.Wm)(a.Z,(0,t.dG)(n,{onClosed:c,"onUpdate:show":u}),null),{open:o,close:i,message:e}}});return e}();u.push(e)}return u[u.length-1]}(),n=d(e);return o.open((0,i.l7)({},c,s.get(n.type||c.type),n)),o}var g=e=>o=>v((0,i.l7)({type:e},d(o))),f=g("loading"),m=g("success"),p=g("fail"),h=e=>{if(u.length){if(e)u.forEach(e=>{e.close()}),u=[];else{var o;u[0].close()}}}}}]); |