Skip to content

Commit b1d0056

Browse files
perf: 重置回答时滚动定位至该回答 (#781)
* chore: 重置回答时滚动定位至该回答 * perf: format code --------- Co-authored-by: ChenZhaoYu <790348264@qq.com>
1 parent 6ecc61a commit b1d0056

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/views/chat/components/Message/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const textRef = ref<HTMLElement>()
3131
3232
const asRawText = ref(props.inversion)
3333
34+
const messageRef = ref<HTMLElement>()
35+
3436
const options = computed(() => {
3537
const common = [
3638
{
@@ -70,12 +72,17 @@ function handleSelect(key: 'copyText' | 'delete' | 'toggleRenderType') {
7072
}
7173
7274
function handleRegenerate() {
75+
messageRef.value?.scrollIntoView()
7376
emit('regenerate')
7477
}
7578
</script>
7679

7780
<template>
78-
<div class="flex w-full mb-6 overflow-hidden" :class="[{ 'flex-row-reverse': inversion }]">
81+
<div
82+
ref="messageRef"
83+
class="flex w-full mb-6 overflow-hidden"
84+
:class="[{ 'flex-row-reverse': inversion }]"
85+
>
7986
<div
8087
class="flex items-center justify-center flex-shrink-0 h-8 overflow-hidden rounded-full basis-8"
8188
:class="[inversion ? 'ml-2' : 'mr-2']"

0 commit comments

Comments
 (0)