index.12c76686.js 2.6 KB

123
  1. import{e as u,r as c,G as k,o as b,a0 as w,t as S,B as W,g as o,h as i,j as d,n as T,x as f,z as B,k as _,p as I,l as m,L as O}from"./vue.e266cb73.js";import{_ as A}from"./_plugin-vue_export-helper.c27b6911.js";const $={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=k({order:1,oneTime:0,twoTime:0,warpOWidth:0,textOWidth:0,isMode:!1}),p=()=>{O(()=>{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;}}`),h(),setTimeout(()=>{r()},n.delay*1e3)})},h=()=>{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;`},y=()=>{a.value.addEventListener("animationend",()=>{r()},!1)},g=()=>{if(!n.mode)return!1;n.mode==="closeable"?(e.isMode=!0,s("close")):n.mode==="link"&&s("link")};return b(()=>{if(n.scrollable)return!1;p(),y()}),(x,z)=>{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:T(["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",$,[_(x.$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:g},null,8,["name"])):f("v-if",!0)],4)],4)),[[W,!e.isMode]])}}});const D=A(R,[["__scopeId","data-v-8dd11bef"],["__file","C:/Users/89282/Desktop/lechang_storage/lechang_storage/vue-next-admin/src/components/noticeBar/index.vue"]]);export{D as default};
  2. //# sourceMappingURL=index.12c76686.js.map