index.3ca04876.js 2.6 KB

123
  1. import{M as u,j as c,a3 as b,m as k,am as w,V as S,$ as T,o,a as i,b as d,P as W,X as f,Z as B,O,T as I,Q as m,n as _}from"./vue.60d2ee98.js";import{_ as $}from"./index.beaea096.js";const A={key:1,class:"notice-bar-warp-slot"},C=u({name:"noticeBar"}),R=u({...C,props:{mode:{type:String,default:()=>""},text:{type:String,default:()=>""},color:{type:String,default:()=>"var(--el-color-warning)"},background:{type:String,default:()=>"var(--el-color-warning-light-9)"},size:{type:[Number,String],default:()=>14},height:{type:Number,default:()=>40},delay:{type:Number,default:()=>1},speed:{type:Number,default:()=>100},scrollable:{type:Boolean,default:()=>!1},leftIcon:{type:String,default:()=>""},rightIcon:{type:String,default:()=>""}},emits:["close","link"],setup(t,{emit:s}){const n=t,l=c(),a=c(),e=b({order:1,oneTime:0,twoTime:0,warpOWidth:0,textOWidth:0,isMode:!1}),p=()=>{_(()=>{e.warpOWidth=l.value.offsetWidth,e.textOWidth=a.value.offsetWidth,document.styleSheets[0].insertRule(`@keyframes oneAnimation {0% {left: 0px;} 100% {left: -${e.textOWidth}px;}}`),document.styleSheets[0].insertRule(`@keyframes twoAnimation {0% {left: ${e.warpOWidth}px;} 100% {left: -${e.textOWidth}px;}}`),y(),setTimeout(()=>{r()},n.delay*1e3)})},y=()=>{e.oneTime=e.textOWidth/n.speed,e.twoTime=(e.textOWidth+e.warpOWidth)/n.speed},r=()=>{e.order===1?(a.value.style.cssText=`animation: oneAnimation ${e.oneTime}s linear; opactity: 1;}`,e.order=2):a.value.style.cssText=`animation: twoAnimation ${e.twoTime}s linear infinite; opacity: 1;`},h=()=>{a.value.addEventListener("animationend",()=>{r()},!1)},x=()=>{if(!n.mode)return!1;n.mode==="closeable"?(e.isMode=!0,s("close")):n.mode==="link"&&s("link")};return k(()=>{if(n.scrollable)return!1;p(),h()}),(g,N)=>{const v=w("SvgIcon");return S((o(),i("div",{class:"notice-bar",style:m({background:t.background,height:`${t.height}px`})},[d("div",{class:"notice-bar-warp",style:m({color:t.color,fontSize:`${t.size}px`})},[t.leftIcon?(o(),i("i",{key:0,class:W(["notice-bar-warp-left-icon",t.leftIcon])},null,2)):f("v-if",!0),d("div",{class:"notice-bar-warp-text-box",ref_key:"noticeBarWarpRef",ref:l},[t.scrollable?(o(),i("div",A,[O(g.$slots,"default",{},void 0,!0)])):(o(),i("div",{key:0,class:"notice-bar-warp-text",ref_key:"noticeBarTextRef",ref:a},B(t.text),513))],512),t.rightIcon?(o(),I(v,{key:1,name:t.rightIcon,class:"notice-bar-warp-right-icon",onClick:x},null,8,["name"])):f("v-if",!0)],4)],4)),[[T,!e.isMode]])}}});const j=$(R,[["__scopeId","data-v-8dd11bef"],["__file","C:/Users/89282/Desktop/xmgl_yjy/project-manager/h5/src/components/noticeBar/index.vue"]]);export{j as default};
  2. //# sourceMappingURL=index.3ca04876.js.map