import React, { Component } from "react"; import ReactDOM from "react-dom"; // e.g. // import { Button, Icon } from "antd"; // import App, { Editor, RenderText } from "./App"; import App, { Editor } from "./App"; import registerServiceWorker from "./registerServiceWorker"; class Index extends Component { constructor(props) { super(props); this.state = { page: 1, value: "" }; this.onPageChange = this.onPageChange.bind(this); this.handleChangeValue = this.handleChangeValue.bind(this); this.handleChangeSubmit = this.handleChangeSubmit.bind(this); } onPageChange(page) { this.setState({ page }); } handleChangeValue(value) { this.setState({ value }); console.log("handleChangeValue value: ", value); } handleChangeSubmit({ text, files }) { this.setState({ loading: true }, () => { setTimeout(() => { this.setState({ loading: false }); }, 2000); }); console.log("submit text: ", text); console.log("submit files: ", files); } render() { // 最简单的用法 return ( { if (response.status === 401) { console.log("unlogined"); } console.log(`-----------${msg}`); }} > { return new Promise(resolve => { resolve(true); }); }} onCommentSuccess={() => { console.log("succ"); }} showError={false} onError={(msg, { response }) => { if (response.status === 401) { console.log("unlogined"); } console.log(`-----------${msg}`); }} /> ); // e.g. // 复杂的用户法 // const props = { // type: 1, // businessId: "1", // API: "http://api.links123.net/comment/v1", // showList: true // }; // const editorProps = { // showEmoji: true, // placeholder: "说点什么吧", // rows: 5, // btnLoading: this.state.loading, // btnDisable: this.state.loading, // btnSubmitText: "提交", // value: this.state.value, // onChange: v => this.handleChangeValue(v), // onSubmit: v => this.handleChangeSubmit(v), // button: ( // // ), // emojiToolIcon: , // imageToolIcon: ( // // ) // }; // return ( // // // // ); } } ReactDOM.render(, document.getElementById("root-comment")); registerServiceWorker();