<template>
    <span>{{ text }}</span>
    
</template>

<script setup>
import { ref, reactive, onMounted, onBeforeMount, onBeforeUnmount, onUnmounted, watch, nextTick } from 'vue'
import { contactDetail } from '@/api/user'
import { groupDetail } from '@/api/group'
const props = defineProps({
    tag_id: {
        type: String,
        default: ''
    },
    robotInfo: {
        type: Object,
        default: {}
    },
    
})
const text = ref('')
watch(() => props.tag_id, async (val) => {
    const res = await contactDetail({
            user_id: val,
            robot_id: props.robotInfo.id
        })
        text.value = res.nickname
        console.log(res.nickname)
})
onMounted(() => {
    if(props.tag_id){
        contactDetail({
            user_id: props.tag_id,
            robot_id: props.robotInfo.id
        }).then(res => {
            text.value = res.nickname
        })
    }
})
</script>