From 14457feb46c20a1b94eae3ea68d13928f3d14e93 Mon Sep 17 00:00:00 2001 From: chengmu Date: Tue, 18 Aug 2015 23:09:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ADD:=20=E5=8E=9F=E7=94=9F=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 3 ++- public/scripts/test1.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 public/scripts/test1.js diff --git a/public/index.html b/public/index.html index c6220169..b6f136c8 100644 --- a/public/index.html +++ b/public/index.html @@ -11,6 +11,7 @@
- + + diff --git a/public/scripts/test1.js b/public/scripts/test1.js new file mode 100644 index 00000000..fcf371da --- /dev/null +++ b/public/scripts/test1.js @@ -0,0 +1,16 @@ +var CommentBox = React.createClass({ + render : function () { + return ( + React.createElement('div', {className: "commentBox"}, + "Hello, world! I am a CommentBox." + ) + ) + } +}); + +React.render( + React.createElement(CommentBox, null), + document.getElementById('content') +); + +// 组件名第一个单词大写 From 105a337b0f40ebb4b2f04bb54bf70e88dec6f644 Mon Sep 17 00:00:00 2001 From: chengmu Date: Tue, 18 Aug 2015 23:21:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=BB=84=E8=A3=85?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 3 ++- public/scripts/test1.js | 6 +++--- public/scripts/test2.js | 20 ++++++++++++++++++++ public/scripts/test3.js | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 public/scripts/test2.js create mode 100644 public/scripts/test3.js diff --git a/public/index.html b/public/index.html index b6f136c8..891614c8 100644 --- a/public/index.html +++ b/public/index.html @@ -12,6 +12,7 @@
- + + diff --git a/public/scripts/test1.js b/public/scripts/test1.js index fcf371da..e5611358 100644 --- a/public/scripts/test1.js +++ b/public/scripts/test1.js @@ -1,15 +1,15 @@ var CommentBox = React.createClass({ render : function () { return ( - React.createElement('div', {className: "commentBox"}, +
"Hello, world! I am a CommentBox." - ) +
) } }); React.render( - React.createElement(CommentBox, null), + , document.getElementById('content') ); diff --git a/public/scripts/test2.js b/public/scripts/test2.js new file mode 100644 index 00000000..e62e1bba --- /dev/null +++ b/public/scripts/test2.js @@ -0,0 +1,20 @@ +var CommentList = React.createClass({ + render : function () { + return ( +
+ hello I am a CommentList +
+ ) + } +}) + +var CommentForm = React.createClass({ + render : function () { + return ( +
+ hello I am a CommentForm +
+ ) + } +}) + diff --git a/public/scripts/test3.js b/public/scripts/test3.js new file mode 100644 index 00000000..b1699b8d --- /dev/null +++ b/public/scripts/test3.js @@ -0,0 +1,15 @@ +var CommentBox = React.createClass({ + render : function () { + return ( +
+ + +
+ ) + } +}) + +React.render( + React.createElement(CommentBox, null), + document.getElementById('content') +); \ No newline at end of file