Chat-React
基于react的聊天会话组件 GitHub地址
演示
使用方法
- 安装
npm install chat-react
复制代码
- 引入
import Chat from 'chat-react';
复制代码
- 使用
export default class MyChat extends Component {
state = {
inputValue: '',
messages: [],
timestamp: new Date().getTime()
}
setInputfoucs = () => {
this.chat.refs.input.inputFocus(); //set input foucus
}
setScrollTop = () => {
this.chat.refs.message.setScrollTop(1200); //set scrollTop position
}
sendMes