index-legacy-6c2d929e.js 1.8 KB

1
  1. System.register(["./index-legacy-979fd4b3.js"],(function(e,t){"use strict";var o,r,l,a,n,s,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,a=e.r,n=e.x,s=e.bN,i=e.bP,c=e.a3,u=e.a2,d=e.w,f=e.g,b=e.v,p=e.a,g=e.I,m=e.a4,w=e.aQ,v=e.aA,h=e.a1,y=e.k}],execute:function(){const[t,x]=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 S=l({name:t,props:k,emits:["close","replay"],setup(e,{emit:t,slots:o}){let r,l=0,y=0;const k=a(),S=a(),I=n({show:!0,offset:0,duration:0}),T=o=>{"closeable"===e.mode&&(I.show=!1,t("close",o))},B=()=>{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},N=()=>{I.offset=l,I.duration=0,v((()=>{w((()=>{I.offset=-y,I.duration=(y+l)/+e.speed,t("replay")}))}))},$=()=>{const t=!1===e.scrollable&&!e.wrapable,r={transform:I.offset?`translateX(${I.offset}px)`:"",transitionDuration:`${I.duration}s`};return p("div",{ref:k,role:"marquee",class:x("wrap")},[p("div",{ref:S,style:r,class:[x("content"),{"van-ellipsis":t}],onTransitionend:N},[o.default?o.default():e.text])])},j=()=>{const{delay:t,speed:o,scrollable:a}=e,n=h(t)?1e3*+t:0;l=0,y=0,I.offset=0,I.duration=0,clearTimeout(r),r=setTimeout((()=>{if(!k.value||!S.value||!1===a)return;const e=m(k).width,t=m(S).width;(a||t>e)&&w((()=>{l=e,y=t,I.offset=-y,I.duration=y/+o}))}),n)};return s(j),i(j),c("pageshow",j),u({reset:j}),d((()=>[e.text,e.scrollable]),j),()=>{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,$(),B()]),[[b,I.show]])}}});e("N",y(S))}}}));