摘要:
'use strict' import 'semantic-ui/semantic.min.css!'; import React, { Component } from 'react'; import ReactDOM from 'react-dom'; // import { Router, R 阅读全文
摘要:
打开CommentBox.js 修改handleCommentSubmit方法 handleCommentSubmit(comment){ // console.log(comment); let comments = this.state.data, newComments = comments. 阅读全文
摘要:
儿子将获取到的数据提交给父亲 打开CommentBox.js 我们在CommentForm标签上添加onCommentSubmit={this.handleCommentSubmit} 创建handleCommentSubmit方法 handleCommentSubmit(comment){ con 阅读全文
摘要:
在input和textarea标签上使用ref属性 <input type="text" placeholder="姓名" ref="author"/> <textarea placeholder="评论" ref="text"></textarea> 在onSubmit={this.handleS 阅读全文
摘要:
事件处理函数的使用 鼠标事件: onClick onContextMenu onDoubleClick onMouseDown onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onDrop onDrag o 阅读全文
摘要:
修改main.js CommentBox标签 <CommentBox url="app/comments.json"/>,document.getElementById('app') 在 app 文件夹下 新建 comments,json 文件 [ {"author": "journey" , "d 阅读全文
摘要:
打开main.js 添加一些模拟数据 var comments = [ {"author": "journey" , "date" : "3分钟前" , "text" : "今天天气有点冷!"}, {"author": "jim" , "date" : "5分钟前" , "text" : "今天早上 阅读全文
摘要:
在comment文件夹下新建Comment.js Comment.js 'use strict' import React from 'react'; class Comment extends React.Component{ render(){ return ( <div className=" 阅读全文
摘要:
在app下的comment文件夹下面分别新建CommentList.js 和 CommentForm.js CommentList.js 'use strict' import React from 'react'; class CommentList extends React.Component 阅读全文