Commit 27110f11 by HoMeTown

feat: 平滑滚动

parent f9032e3b
...@@ -120,7 +120,8 @@ export const Chat: React.FC = () => { ...@@ -120,7 +120,8 @@ export const Chat: React.FC = () => {
}, [shouldSendQuestion]) }, [shouldSendQuestion])
const scrollToBottom = () => { const scrollToBottom = () => {
scrollableRef.current.scrollTop = scrollableRef.current.scrollHeight // scrollableRef.current.scrollTop = scrollableRef.current.scrollHeight
scrollableRef.current.scrollTo(scrollableRef.current.scrollHeight, { behavior: 'smooth' })
} }
useEffect(() => { useEffect(() => {
...@@ -150,7 +151,7 @@ export const Chat: React.FC = () => { ...@@ -150,7 +151,7 @@ export const Chat: React.FC = () => {
duration: 0.3, duration: 0.3,
opacity: { duration: 0.1 }, opacity: { duration: 0.1 },
}} }}
className={`${styles.scrollable} scrollbar-hide`} className={`${styles.scrollable} scrollbar-hide scroll-smooth`}
> >
<div className={styles.inter}> <div className={styles.inter}>
{allItems.map((record, index) => ( {allItems.map((record, index) => (
......
...@@ -11,7 +11,7 @@ interface ChatAnswerShowerProps { ...@@ -11,7 +11,7 @@ interface ChatAnswerShowerProps {
} }
export const ChatAnswerShower: React.FC<ChatAnswerShowerProps> = ({ answer, isLastAnswer, onSubmitQuestion }) => { export const ChatAnswerShower: React.FC<ChatAnswerShowerProps> = ({ answer, isLastAnswer, onSubmitQuestion }) => {
const hideOperate = answer.attachmentList.some(attachment => attachment.type === 'box') const hideOperate = (answer.attachmentList || []).some(attachment => attachment.type === 'box')
return ( return (
<div className="answerShower"> <div className="answerShower">
{answer.answer && ( {answer.answer && (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment