diff --git a/public/react/src/modules/message/js/MessagChat.js b/public/react/src/modules/message/js/MessagChat.js index abb67dec8..666ba535d 100644 --- a/public/react/src/modules/message/js/MessagChat.js +++ b/public/react/src/modules/message/js/MessagChat.js @@ -11,7 +11,7 @@ import Leftdialogue from './Leftdialogue' class MessagChat extends Component{ constructor(props) { super(props); - this.messageRef = React.createRef(); + this.state={ isSpin:false, isSpins:false, @@ -53,8 +53,12 @@ class MessagChat extends Component{ } scrollToBottom() { - this.el.scrollIntoView({ behavior: 'smooth' }); + const scrollHeight = this.messageList.scrollHeight; + const height = this.messageList.clientHeight; + const maxScrollTop = scrollHeight - height; + this.messageList.scrollTop = maxScrollTop > 0 ? maxScrollTop : 0; } + // 滑动刷新 contentViewScrolledit=(e)=>{ @@ -351,6 +355,8 @@ class MessagChat extends Component{ messages:this.state.messages, isSpin:false, }) + + this.scrollToBottom() } } } @@ -391,10 +397,13 @@ class MessagChat extends Component{ {myuserl!==undefined?myuserl.name:""}与你的私信
{/*聊天页面*/} -- - {item.target.name} - {item.unread === true? - - :""} - + + {item.target.name} + {item.unread === true? + + :""} + {moment(item.send_time).fromNow()}