feat: 进入对话滚动到底部
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="chat-list" ref="chatListRef">
|
||||
<div class="chat-message-item" v-for="message in list" :key="message.id">
|
||||
<NoticeItem
|
||||
:value="message"
|
||||
<NoticeItem
|
||||
:value="message"
|
||||
:is-streaming="isStreaming && streamingMessage?.id === message.id"
|
||||
/>
|
||||
</div>
|
||||
@@ -11,8 +11,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import NoticeItem from './NoticeItem.vue'
|
||||
import GenerateLoading from './GenerateLoading.vue'
|
||||
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
||||
import { ref, onMounted, watch, nextTick } from 'vue'
|
||||
|
||||
// 定义消息类型
|
||||
interface ChatMessage {
|
||||
@@ -63,10 +62,20 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
// 页面挂载时滚动到底部
|
||||
onMounted(async () => {
|
||||
await nextTick()
|
||||
scrollToBottom()
|
||||
})
|
||||
|
||||
const handleSendMessage = (message: string): void => {
|
||||
console.log('list发送消息:', message)
|
||||
emits('send-message', message)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
scrollToBottom
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
Reference in New Issue
Block a user