0.0.8 • Published 2 years ago

shinemo-web-comment v0.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

web评论组件

效果

效果

使用

参数类型备注
visibleBoolean控制控件显示隐藏; true显示
disableUploadFileBoolean禁止上传文件; true禁止,默认false
disableUploadImageBoolean禁止上传图片; true禁止,默认false
imageCountNumber上传图片个数
fileCountNumber上传文件个数
valueCountNumber输入框字符个数
onCancleFunction取消按钮回调
onConfirmFunction确定按钮回调
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)
})