<script setup>
|
import {computed} from "vue";
|
|
const props = defineProps({
|
type: {
|
type: [Number, String],
|
default: 0,
|
},
|
blBl: {
|
type: Boolean,
|
default: true
|
}
|
});
|
|
const lightState = computed(()=>{
|
let state = "";
|
let type = props.type > 1 ? 1 : props.type;
|
switch (type) {
|
case 1:
|
state = "error-light";
|
break;
|
case -1:
|
state = "gray-light";
|
break;
|
default:
|
state = "";
|
break;
|
}
|
|
if(props.blBl) {
|
state+=" bl-bl"
|
}
|
|
return state;
|
});
|
</script>
|
|
<template>
|
<div class="hdw-light" :class="lightState"></div>
|
</template>
|
|
<style lang="less" scoped>
|
/* light */
|
.hdw-light {
|
position: relative;
|
display: inline-block;
|
width: 22px;
|
height: 22px;
|
vertical-align: middle;
|
}
|
|
.hdw-light:before {
|
content: "";
|
display: inline-block;
|
position: absolute;
|
top: 50%;
|
left: 50%;
|
margin-top: -5px;
|
margin-left: -5px;
|
width: 10px;
|
height: 10px;
|
border-radius: 10px;
|
background-color: #4afd88;
|
box-shadow: 0 0 6px 6px #4afd8880;
|
}
|
|
.hdw-light.error-light.bl-bl:before {
|
background-color: #fd5b67;
|
animation: errorLight 1000ms infinite;
|
box-shadow: 0 0 6px 6px #fd586480;
|
}
|
.hdw-light.error-light:before {
|
background-color: #fd5b67;
|
box-shadow: 0 0 6px 6px #fd586480;
|
}
|
.hdw-light.gray-light:before {
|
background-color: #878787;
|
width: 12px;
|
height: 12px;
|
box-shadow: none;
|
}
|
|
@keyframes errorLight {
|
0% {
|
opacity: 1;
|
box-shadow: 0 0 6px 6px #fd586480;
|
}
|
50% {
|
opacity: 0.3;
|
box-shadow: 0 0 0 0 #fd586480;
|
}
|
100% {
|
opacity: 1;
|
box-shadow: 0 0 6px 6px #fd586480;
|
}
|
}
|
</style>
|