index-legacy-5d93fc18.js 1.8 KB

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