<!--
 * @Author: Fly
 * @Date: 2025-12-12 14:43:50
 * @LastEditTime: 2025-12-12 15:07:46
 * @Description: 
-->
<template>
    <div>
        <template v-if="label || label === 0">
            <template v-if="type">
                <el-tag :type="type" :size="ELsize">
                    {{ label }}
                </el-tag>
            </template>
            <template v-else>
                {{ label }}
            </template>
        </template>
        <template v-else>
            {{ label | TableItemEmpty}}
        </template>
    </div>
</template>

<script>
import { isObject } from '@/utils/validate'
export default {
    name: 'StatusTag',
    props: {
        statusVo: {
            // type: [String, Number],
            default: ''
        }
    },
    data() {
        return {
            type: '',
            label: '',
        };
    },
    watch: {
        statusVo: {
            handler(newVal, oldVal) {
                try {
                    if (isObject(newVal)) {
                        const { value, label, type } = newVal
                        // console.log("isObject(newVal) value = ", value)
                        this.type = type || ''
                        this.label = label || value
                    } else {
                        throw new Error('statusVo 格式错误')
                    }
                } catch (error) {

                    // console.log("isObject(newVal) error= ", error)
                    this.label = newVal
                }

            },
            immediate: true,
            deep: true
        }
    },
};
</script>

<style lang='scss' scoped></style>