Angularjs字符串拼接变量很简单,因为里面都是js操作,所以不论是
<a ng-href="http://each.sinaapp.com/angular + {{variable}}">
or
<a ng-href="{{'http://each.sinaapp.com/angular'+variable}}">
可以的,而在React里面确有点小小的区别,因为里面的Element后面若有变量不允许双引号包围的。所以
<a href="http://each.sinaapp.com/angular{variable}">
or
<a href="http://each.sinaapp.com/angular"+{variable}>
// 都不可以
// 只能这样
<a href={'http://each.sinaapp.com/angular' + variable}>
or
<a href={'http://each.sinaapp.com/angular' + this.props.username}>
{this.props.username}
</a>
or
<i className={"header-help-icon down" + isShowLoginMenu ? ' up' : ''}></i>
有疑问或技术交流,扫描公众号一起讨论学习。
更多React在线学习访问:http://each.sinaapp.com/react/index.html

2286

被折叠的 条评论
为什么被折叠?



