代码改变世界

随笔档案-2016年09月

数组拼接

2016-09-22 11:01 by 路途遥远,Go~, 368 阅读, 收藏,
摘要: var a = [1,2,4];var b = [3,4,5];undefineda[1, 2, 4]b[3, 4, 5]var c = a.concat(b)undefinedc[1, 2, 4, 3, 4, 5] 阅读全文

react 年-月-日 时:分:秒

2016-09-22 10:40 by 路途遥远,Go~, 623 阅读, 收藏,
摘要: // 时间let date = new Date();debugger;let seperator1 = "-";let seperator2 = ":";let month = date.getMonth() + 1;let strDate = date.getDate();if (month > 阅读全文

react-native 计算时间差

2016-09-22 10:39 by 路途遥远,Go~, 3329 阅读, 收藏,
摘要: //计算时间var sendTime = this.props.obj.send_time;console.log(sendTime);//当前时间var nowTime = (new Date()).valueOf();console.log(nowTime);//差值var date3 = no 阅读全文

replace截取字段

2016-09-14 17:55 by 路途遥远,Go~, 419 阅读, 收藏,
摘要: var a = '123:'b = '123:disfkajsdhfjkasdhf'c = b.replace(a, '')"disfkajsdhfjkasdhf" 阅读全文

react 评论列表插入评论数据 unshift

2016-09-13 17:38 by 路途遥远,Go~, 743 阅读, 收藏,
摘要: // unshift 新增数据放到最上面//插入 回复/发表 评论else if(action.type INSERT_COMMENT ){ let content = action.text; let senderName = action.replyName; let index = actio 阅读全文

react input 获取/失去焦点

2016-09-08 21:14 by 路途遥远,Go~, 33567 阅读, 收藏,
摘要: <div className={ this.state.focus ? "dis_bottom_left_onfocus" : "dis_bottom_left" } ref="bottom_left"> <input type="text" className="dis_bottom_input" 阅读全文

react js 按条数 展开/折叠

2016-09-07 17:12 by 路途遥远,Go~, 3667 阅读, 收藏,
摘要: //2条const MAX_SHOW_NUM = 2;class HotDiscuss extends Component { static propTypes = { //验证 repliedCommentList: PropTypes.array, }; constructor(props) { 阅读全文