vue 判断在线离线组件封装

vue yekong 688℃
/**
* @Author: 858834013@qq.com
* @Name: status
* @Date: 2022-02-19
* @Desc:
*/
<template>
  <div>
    <div v-if="isOnline" class="onLine">在线</div>
    <div v-else class="offLine">离线</div>
  </div>
</template>

<script>

export default {
  name: "status",
  components: {},
  props: {
    isOnline: {
      type: Boolean,
      default() {
        return false;
      }
    }
  },
  data() {
    return {}
  },
  watch: {},
  mounted() {
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.offLine {
  width: 44px;
  height: 24px;
  background: rgba(192, 68, 59, 0.15);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  flex-direction: row;
  font-size: 14px;
  font-family: PingFang;
  font-weight: bold;
  color: rgba(192, 68, 59, 1);
}

.onLine {
  width: 44px;
  height: 24px;
  background: rgba(#13C770, 0.15);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  flex-direction: row;
  font-size: 14px;
  font-family: PingFang;
  font-weight: bold;
  color: #15BE92;
}
</style>

喜欢 (0)