摘要:
摘自:https://segmentfault.com/a/1190000007935557 一、JSONP的诞生 首先,因为ajax无法跨域,然后开发者就有所思考 其次,开发者发现, <script>标签的src属性是可以跨域的把跨域服务器写成 调用本地的函数 ,回调数据回来不就好了? json刚 阅读全文
随笔分类 - js
页面按钮埋点+跟踪location.search
2017-01-13 18:32 by 路途遥远,Go~, 1012 阅读, 收藏,
摘要:
<a href="javascript: void(0)" onclick="setUrl('https://baoxian.pingan.com/pa18shopnst/u/wx/product/annualNew/dispatch.shtml?WT.mc_id=yd-adsjan')" otit 阅读全文
正则表达式/g与/i及/gi的意义
2016-11-02 17:46 by 路途遥远,Go~, 548 阅读, 收藏,
摘要:
g: 全局匹配 i: 忽略大小写 gi: 全局匹配 + 忽略大小写 阅读全文
input固定在底部
2016-10-27 20:59 by 路途遥远,Go~, 1232 阅读, 收藏,
摘要:
// input固定在底部//isFocusing获取焦点:true 失去焦点:false _onTouchInput(isFocusing){ this.phone_width = screen.width; let Boxbottom = this.refs['InputBoxBottom']; 阅读全文
js 点赞数 处理
2016-10-09 10:53 by 路途遥远,Go~, 1956 阅读, 收藏,
摘要:
likeNum(num) { if (num 0) { num = ''; } else if (num > 9999 && num <= 9999999) { num = parseInt(num / 10000); num = parseInt(num) + "万"; } else if (nu 阅读全文
js插入拼接链接 --包含可变字段
2016-10-08 11:01 by 路途遥远,Go~, 793 阅读, 收藏,
摘要:
// newsId: 传参过来的Id, pathIdlet newsDetailId = parseInt(this.props.newsId); goTo() { window.location.hash = '#/allcommentslist/' + newsDetailId ;} 阅读全文
数组拼接
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 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) { 阅读全文
单位px 转换成 rem
2016-08-24 10:36 by 路途遥远,Go~, 3875 阅读, 收藏,
摘要:
<script type="text/javascript"> var oHtml = document.documentElement; getSize(); window.onresize = function(){ getSize(); }; function getSize(){ var s 阅读全文
头部固定下面滑动&&获取手机屏高
2016-08-17 10:09 by 路途遥远,Go~, 575 阅读, 收藏,
摘要:
height(){ //获取屏高 let phone_height = document.documentElement.clientHeight; let group = this.refs.search; //console.log(group,phone_height); //40px 是顶部 阅读全文
js 点击展开、收起
2016-08-09 17:27 by 路途遥远,Go~, 2798 阅读, 收藏,
摘要:
//点击展开、收起 window.onload=function(){ var current=document.getElementsByTagName('li')[0]; document.body.addEventListener('touchend', function(e) { var s 阅读全文
js - ajax中的get和post说明
2016-08-08 20:33 by 路途遥远,Go~, 3552 阅读, 收藏,
摘要:
转自:http://www.cnblogs.com/hateyoucode/archive/2009/12/09/1620050.html 一.谈Ajax的Get和Post的区别 Get方式: 用get方式可传送简单数据,但大小一般限制在1KB下,数据追加到url中发送(http的header传送) 阅读全文
js 多选题选项内容显示在标题下
2016-08-02 10:35 by 路途遥远,Go~, 644 阅读, 收藏,
摘要:
<body><div class="page-container"> <div class="view-container"> <header class="navbar"> <div class="navbar-back" onclick="window.history.go(-1)">返回</d 阅读全文
浙公网安备 33010602011771号