<!--
 * @Author: changjun
 * @FilePath: /qingdao-safety-product/src/views/screen/components/NumberPlate.vue
 * @Date: 2022-07-08 08:52:06
 * @Description: 数字板组件
 * @LastEditTime: 2023-09-01 15:23:43
 * @LastEditors: 曹文丽
-->
<script setup lang="ts">
import { ref, defineProps, computed, unref } from 'vue'
interface NumberPlateProps {
  number: string | number,
}

const props = defineProps<NumberPlateProps>()
const getClass = computed(() => {
  if (unref(props.number) > 5) return `number-box number-box-5`
  return `number-box number-box-${props.number}`
})
</script>

<template>
  <div :class="getClass">{{ number }}</div>
</template>

<style scoped lang="scss">
.number-box {
  width: 20px;
  height: 18px;
  border-radius: 2px;
  font-size: 12px;
  color: #ffffff;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.number-box::after {
  content: '';
  display: inline-block;
  position: absolute;
  right: -3px;
  top: 6px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 3.5px 0 3.5px 4px;
  border-color: transparent transparent transparent transparent;
}

.number-box-1 {
  background: #ea4668;
}

.number-box-1::after {
  border-color: transparent transparent transparent #ea4668;
}

.number-box-2 {
  background: #ff9800;
}

.number-box-2::after {
  border-color: transparent transparent transparent #ff9800;
}

.number-box-3 {
  background: #eac018;
}

.number-box-3::after {
  border-color: transparent transparent transparent #eac018;
}

.number-box-4 {
  background: #049bfb;
}

.number-box-4::after {
  border-color: transparent transparent transparent #049bfb;
}

.number-box-5 {
  background: #049bfb;
}

.number-box-5::after {
  border-color: transparent transparent transparent #049bfb;
}
</style>
