<template>
    <div class="contet">
        【聊天频道】. <Abutton @click="Refresh">刷新</Abutton><br />
        <Abar href="/news">*更新内容早知道</Abar>
    </div>
    <div class="title">
        <Acheak @click="BindData('')" :on-value="type" on-cheak="">公共</Acheak>.
        <Acheak @click="BindData('1')" :on-value="type" on-cheak="1">队伍</Acheak>.
        <Acheak @click="BindData('2')" :on-value="type" on-cheak="2">帮派</Acheak>.
        <Acheak @click="BindData('3')" :on-value="type" on-cheak="3">全区</Acheak>.
        <Acheak @click="BindData('4')" :on-value="type" on-cheak="4">系统</Acheak>.
        <Acheak @click="BindData('5')" :on-value="type" on-cheak="5">全服</Acheak>
    </div>
    <div class="chat">
        <div class="item">
            暂无发言.
        </div>
    </div>
</template>
<script setup lang="ts">
definePageMeta({
    layout: layout.default,
    middleware: 'page-loading'
})

const type = ref('');

onMounted(async () => {
    try {
        await BindData(type.value);
    }
    finally {
        PageLoading.Close();
    }
})

const BindData = async (typeid: string): Promise<void> => {
    if (type.value != typeid) {
        type.value = typeid;
    }
};

/**刷新 */
const Refresh = async (): Promise<void> => {
    MessageExtend.LoadingToast("刷新中...");
    await BindData(type.value);
    MessageExtend.LoadingClose();
    MessageExtend.Notify("刷新成功!", "success");
    PageExtend.ScrollToTop();
}
</script>