@@ -87,6 +87,14 @@ class TopicDetail extends Component {
8787 id
8888 } )
8989 }
90+ reply ( name ) {
91+ const at = `@${ name } `
92+ this . refs . textarea . value = at
93+ this . refs . textarea . focus ( )
94+ this . setState ( {
95+ reply : at
96+ } )
97+ }
9098 handleInput ( e ) {
9199 this . setState ( {
92100 reply : e . target . value . trim ( )
@@ -140,9 +148,15 @@ class TopicDetail extends Component {
140148 < span className = "time_stamp" > { format ( item . create_at ) } </ span >
141149 < span className = "floor" > { index + 1 } 楼</ span >
142150 </ div >
143- < div className = { 'user_action ' + ( item . is_uped ? 'liked' : '' ) } onClick = { this . like . bind ( this , item . id , item . author . loginname ) } >
144- < span className = "iconfont icon-thumbup" > </ span >
145- < span className = "up_number" > { item . ups . length } </ span >
151+ { /*赞*/ }
152+ < div className = "user_action" >
153+ < div className = { 'action_item' + ( item . is_uped ? 'liked' : '' ) } onClick = { this . like . bind ( this , item . id , item . author . loginname ) } >
154+ < span className = "iconfont icon-thumbup" > </ span >
155+ < span className = "up_number" > { item . ups . length } </ span >
156+ </ div >
157+ < div className = "action_item" onClick = { this . reply . bind ( this , item . author . loginname ) } >
158+ < span className = "iconfont icon-reply" > </ span >
159+ </ div >
146160 </ div >
147161 </ div >
148162 < div className = "comment_content" dangerouslySetInnerHTML = { { __html : item . content } } />
@@ -168,7 +182,7 @@ class TopicDetail extends Component {
168182 < div className = "topic_reply" >
169183 < p > 添加评论</ p >
170184 < div className = "form" >
171- < textarea onChange = { this . handleInput . bind ( this ) } > </ textarea >
185+ < textarea ref = "textarea" onChange = { this . handleInput . bind ( this ) } > </ textarea >
172186 < div className = "button button_info" onClick = { this . submit . bind ( this ) } > 提交</ div >
173187 </ div >
174188 </ div >
0 commit comments