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