<template>
    <div class="chat">
        <div class="item" v-for="(item, index) in data" :key="index">
            <span>[{{ GetChatType(item.chat.code) }}]</span>
            <span>
                <span v-if="item.chat.code == 'System'">
                    海精灵:
                </span>
                <span v-if="item.chat.code != 'System'">
                    <GameUser :data="item.user" :show-icon="1"></GameUser>:
                </span>
                <span v-html="item.chat.sign" @click="HtmlEvent">                    
                </span>
                <span v-if="showTime == 1">
                    ({{ TimeExtend.StrToFormat(item.chat.addTime, "dd日HH:mm") }})
                </span>
            </span>
        </div>
    </div>
</template>
<script lang="ts" setup>
const props = defineProps({
    // 字段名、类型、默认值
    data: Array<any>,
    showTime: Number,
    page: Number,
    limit: Number
})

const GetChatType = (type: string) => {
    let result = "";
    switch (type) {
        case "Public":
            result = "公共";
            break;
        case "Team":
            result = "队伍";
            break;
        case "Group":
            result = "帮派";
            break;
        case "Region":
            result = "全区";
            break;
        case "Dress":
            result = "全服";
            break;
        case "System":
            result = "系统";
            break;

    }
    return result;
}
</script>