Index-a05dbbd2.js 2.5 KB

1
  1. import{u as C}from"./index-2c34a50f.js";import{d as S,i as d,v as T,n as B,x as H,q as I,r as v,o,y as n,e,F as h,B as E,c as g,w as m,t as p,f as L,O as N,C as O,_ as U}from"./index-bed2942a.js";const D={class:"cus-animation",style:{height:"100%",width:"100%",display:"flex","flex-direction":"column"}},F={style:{color:"#fff","font-size":"14px"}},V={style:{width:"100%",overflow:"hidden",display:"flex","margin-bottom":"6px"}},z={style:{"margin-left":"10px"}},A={key:0,style:{color:"green"}},M={key:1,style:{color:"red"}},R={style:{"margin-left":"10px",width:"0px","flex-grow":"1","text-align":"left","word-wrap":"break-word","word-break":"break-all"}},G={style:{"text-align":"right",height:"0px",position:"fixed",right:"120px",bottom:"72px"}},P={style:{"margin-top":"10px","margin-right":"16px"}},Y={key:0},q={key:1},J=S({__name:"Index",setup(W){const t=d(null),s=T([]),x=d(),u=C();u.onmessage=l=>{const r=JSON.parse(l.data);if(!c.value&&r.messageType=="PUBLISH"){const a=r.content;for(a.date=r.date,console.log(a),s.push(a);s.length>300;)s.shift()}};const y=()=>{s.splice(0,s.length)},c=d(!1),k=()=>{c.value=!c.value},b=function(){return t.value};B(()=>{u.open({subscription:["/pump/data"]}).then(l=>{console.log("连接成功",l)},l=>{console.log("连接失败",l)}),console.log("onMounted"),console.log({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1,LEGACY:!1}),x.value="production"}),H(()=>{u.close(),console.log("onUnmounted")});const _=d(!0);I(()=>{_.value&&(t.value.scrollTop=t.value.scrollHeight)});const w=function(){t.value.clientHeight+t.value.scrollTop>=t.value.scrollHeight?_.value=!0:_.value=!1};return(l,r)=>{const a=v("a-back-top"),f=v("a-button");return o(),n(h,null,[e("div",D,[e("div",{ref_key:"divContent",ref:t,class:"tr-content",onScroll:w,id:"backtop",style:{background:"#3f3b3b",padding:"16px",overflowY:"auto",flexGrow:1}},[e("div",F,[(o(!0),n(h,null,E(s,i=>(o(),n("div",V,[e("div",null,[e("span",null,p(L(N)(i.date)),1)]),e("div",z,[i.logType=="INFO"?(o(),n("span",A,p(i.logType),1)):(o(),n("span",M,p(i.logType),1))]),e("div",R,[e("span",null,p(i.content),1)])]))),256))])],544)]),e("div",null,[g(a,{target:b,visibilityHeight:200})]),e("div",G,[e("div",P,[g(f,{type:"default",size:"small",onClick:k,style:{"margin-right":"10px"}},{default:m(()=>[c.value?(o(),n("span",Y,"继续")):(o(),n("span",q,"停止"))]),_:1}),g(f,{type:"danger",size:"small",onClick:y},{default:m(()=>[O("清空")]),_:1})])])],64)}}});const Q=U(J,[["__scopeId","data-v-88445753"]]);export{Q as default};