0.0.8 • Published 2 years ago
shinemo-web-comment v0.0.8
web评论组件
效果
使用
参数 | 类型 | 备注 |
---|---|---|
visible | Boolean | 控制控件显示隐藏; true显示 |
disableUploadFile | Boolean | 禁止上传文件; true禁止,默认false |
disableUploadImage | Boolean | 禁止上传图片; true禁止,默认false |
imageCount | Number | 上传图片个数 |
fileCount | Number | 上传文件个数 |
valueCount | Number | 输入框字符个数 |
onCancle | Function | 取消按钮回调 |
onConfirm | Function | 确定按钮回调 |
import React from 'react'
import ReactDOM from 'react-dom'
import Comment from './components/Comment'
import styles from './index.scss'
class App extends React.Component {
constructor (props) {
super(props)
this.state = {
visible: false
}
this.hide = this.hide.bind(this)
this.show = this.show.bind(this)
}
show () {
this.setState({
visible: true
})
}
hide () {
this.setState({
visible: false
})
}
handleChange(e){
console.log(e)
}
render () {
const {visible} = this.state
return (
<div>
<button onClick={this.show}>显示</button>
<button onClick={this.hide}>隐藏</button>
<div className={styles.container}>
<Comment visible={visible}
imageCount = {20}
fileCount = {10}
valueCount = {300}
placeholder = '说点什么呢的'
onCancle={this.handleChange.bind(this)}
onConfirm={this.handleChange.bind(this)}
/>
</div>
</div>
)
}
}
window.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(<App/>, document.body)
})