perf: 重置回答时滚动定位至该回答 (#781)

* chore: 重置回答时滚动定位至该回答

* perf: format code

---------

Co-authored-by: ChenZhaoYu <790348264@qq.com>
This commit is contained in:
舜岳 2023-03-22 17:54:29 +08:00 committed by GitHub
parent 6ecc61ac5d
commit b1d0056429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,8 @@ const textRef = ref<HTMLElement>()
const asRawText = ref(props.inversion)
const messageRef = ref<HTMLElement>()
const options = computed(() => {
const common = [
{
@ -70,12 +72,17 @@ function handleSelect(key: 'copyText' | 'delete' | 'toggleRenderType') {
}
function handleRegenerate() {
messageRef.value?.scrollIntoView()
emit('regenerate')
}
</script>
<template>
<div class="flex w-full mb-6 overflow-hidden" :class="[{ 'flex-row-reverse': inversion }]">
<div
ref="messageRef"
class="flex w-full mb-6 overflow-hidden"
:class="[{ 'flex-row-reverse': inversion }]"
>
<div
class="flex items-center justify-center flex-shrink-0 h-8 overflow-hidden rounded-full basis-8"
:class="[inversion ? 'ml-2' : 'mr-2']"