dev_cs_new
杨树明 6 years ago
parent c245781db7
commit 65dce68b92

@ -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:""}与你的私信
</p>
{/*聊天页面*/}
<div className="dialogPanel">
<div className="dialogPanel"
ref={(div) => {
this.messageList = div;
}}>
<div >
<Spin size="large" className="myw100baifenbi" spinning={isSpin}>
<div id="yslysl" ref={el => { this.el = el; }}>
<div id="yslysl" >
{
messages===undefined?
""

Loading…
Cancel
Save