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

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

* perf: format code

---------

Co-authored-by: ChenZhaoYu <790348264@qq.com>
main
舜岳 2 years ago committed by GitHub
parent 6ecc61ac5d
commit b1d0056429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save