admin-vue3/src/components/Im/UserStatus/src/UserStatus.vue

42 lines
901 B
Vue

<script setup lang="ts">
/* 单聊用户在线状态 */
import { ref } from 'vue'
const userInfoStatus = ref({
style: '',
label: '',
onlineDeviceCount: 1, //在线设备数
deviceType: '' //在线设备类型
})
</script>
<template>
<div class="user_status_box">
<span class="status_icon" :style="userInfoStatus.style"></span>
<span class="os_type">{{
userInfoStatus.onlineDeviceCount > 1
? `多设备${userInfoStatus.label}`
: `${userInfoStatus.deviceType.toUpperCase()}${userInfoStatus.label}`
}}</span>
</div>
</template>
<style scoped lang="scss">
.user_status_box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
width: 100px;
height: 100%;
font-size: 7px;
.status_icon {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
margin: 0 3px;
}
}
</style>