Files
yudao-ui-admin-vue3/src/views/im/Conversation/index.vue

60 lines
1.7 KiB
Vue
Raw Normal View History

2024-04-24 20:54:13 +08:00
<script setup lang="ts">
import { ref, defineAsyncComponent } from 'vue'
2024-04-28 22:02:38 +08:00
import { SearchInput } from '@/components/Im/SearchInput'
2024-04-24 20:54:13 +08:00
import ConversationList from '../Conversation/components/ConversationList.vue'
import { Welcome } from '@/components/Im/Welcome'
// 异步加载可能的对话框内容组件
const InformDetailsComponent = defineAsyncComponent(
() => import('@/views/im/InformDetails/index.vue')
)
const MessageComponent = defineAsyncComponent(() => import('@/views/im/Message/index.vue'))
2024-04-27 23:10:03 +08:00
const currentComponent = ref(Welcome) // 默认加载欢迎页组件
// 更改为使用动态组件切换而非路由跳转
2024-04-27 23:10:03 +08:00
const toInformDetails = () => {
currentComponent.value = InformDetailsComponent // 加载系统通知组件
2024-04-27 23:10:03 +08:00
}
const toChatMessage = (id, chatType) => {
console.log('>>>>>>>id', id)
currentComponent.value = MessageComponent // 加载消息组件
2024-04-27 23:10:03 +08:00
}
2024-04-24 20:54:13 +08:00
</script>
2024-04-24 20:54:13 +08:00
<template>
<el-container style="height: 100%">
<el-aside class="chat_conversation_box">
<!-- 搜索组件 -->
<SearchInput :searchType="'conversation'" />
<div class="chat_conversation_list">
2024-04-28 22:02:38 +08:00
<ConversationList @to-inform-details="toInformDetails" @to-chat-message="toChatMessage" />
2024-04-24 20:54:13 +08:00
</div>
</el-aside>
<el-main class="chat_conversation_main_box">
<component :is="currentComponent" />
2024-04-24 20:54:13 +08:00
</el-main>
</el-container>
</template>
<style lang="scss" scoped>
.chat_conversation_box {
position: relative;
background: #cfdbf171;
overflow: hidden;
min-width: 324px;
.chat_conversation_list {
height: calc(100% - 60px);
}
}
.chat_conversation_main_box {
position: relative;
width: 100%;
height: 100%;
padding: 0;
}
</style>