deep-clone-legacy-899bee69.js 2.0 KB

1
  1. System.register(["./index-legacy-3123d13a.js"],(function(e,t){"use strict";var o,r,n,a,l,s,i,c,u,f,d,p,b,g,y,m,w,h,v;return{setters:[e=>{o=e.y,r=e.E,n=e.d,a=e.I,l=e.r,s=e.ae,i=e.a0,c=e.n,u=e.aa,f=e.j,d=e.as,p=e.ay,b=e.a,g=e.S,y=e.a6,m=e.aq,w=e.V,h=e.af,v=e.w}],execute:function(){const[t,S]=o("notice-bar"),k={text:String,mode:String,color:String,delay:r(1),speed:r(60),leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,"default":null}};var x=n({name:t,props:k,emits:["close","replay"],setup(e,{emit:t,slots:o}){let r,n=0,v=0;const k=a(),x=a(),j=l({show:!0,offset:0,duration:0}),I=o=>{"closeable"===e.mode&&(j.show=!1,t("close",o))},A=()=>{if(o["right-icon"])return o["right-icon"]();const t="closeable"===e.mode?"cross":"link"===e.mode?"arrow":void 0;return t?b(g,{name:t,"class":S("right-icon"),onClick:I},null):void 0},T=()=>{j.offset=n,j.duration=0,w((()=>{m((()=>{j.offset=-v,j.duration=(v+n)/+e.speed,t("replay")}))}))},q=()=>{const t=!1===e.scrollable&&!e.wrapable,r={transform:j.offset?`translateX(${j.offset}px)`:"",transitionDuration:`${j.duration}s`};return b("div",{ref:k,role:"marquee","class":S("wrap")},[b("div",{ref:x,style:r,"class":[S("content"),{"van-ellipsis":t}],onTransitionend:T},[o["default"]?o["default"]():e.text])])},B=()=>{const{delay:t,speed:o,scrollable:a}=e,l=h(t)?1e3*+t:0;n=0,v=0,j.offset=0,j.duration=0,clearTimeout(r),r=setTimeout((()=>{if(!k.value||!x.value||!1===a)return;const e=y(k).width,t=y(x).width;(a||t>e)&&m((()=>{n=e,v=t,j.offset=-v,j.duration=v/+o}))}),l)};return s(B),i(B),c("pageshow",B),u({reset:B}),f((()=>[e.text,e.scrollable]),B),()=>{const{color:t,wrapable:r,background:n}=e;return d(b("div",{role:"alert","class":S({wrapable:r}),style:{color:t,background:n}},[o["left-icon"]?o["left-icon"]():e.leftIcon?b(g,{"class":S("left-icon"),name:e.leftIcon},null):void 0,q(),A()]),[[p,j.show]])}}});e("N",v(x));const j=e("d",(e=>{if(null===e)return null;const t=Object.assign({},e);return Object.keys(t).forEach((o=>t[o]="object"==typeof e[o]?j(e[o]):e[o])),Array.isArray(e)?(t.length=e.length,Array.from(t)):t}))}}}));