<template>
  <el-tag :type="type">{{statusName}}</el-tag>
</template>

<script>
export default {
  props: {
    status: {
      type: Number,
      required: true
    }
  },
  computed: {
    statusName() {
      if (this.status === 0) {
        return this.$t('未连接')
      } else if (this.status === 2) {
        return this.$t('已连接')
      } else {
        return this.$t('正在重连')
      }
    },
    type() {
      if (this.status === 2) {
        return 'success'
      } else if (this.status === 0) {
        return 'danger'
      } else {
        return 'warning'
      }
    }
  }
}
</script>
