随笔分类 -  JS

摘要:axios 一些关于axios的使用技巧 拦截器 var baseUrl = "http://localhost:19800/api/"; const request = axios.create({ // api 的 base_url baseURL: baseUrl, timeout: 1000 阅读全文
posted @ 2021-11-05 15:58 Alex_Mercer 阅读(51) 评论(0) 推荐(0)
摘要:js 日期扩展方法 addMonth addYear 说明 一直想要c#里面的addMonth,addYear啥的,但是js没有,所以就自己简写了一个 代码 Date.prototype.addMonth=function(val){ let year=this.getFullYear() let 阅读全文
posted @ 2021-01-08 14:27 Alex_Mercer 阅读(303) 评论(0) 推荐(0)
摘要:JS 获取上一个月 const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); 阅读全文
posted @ 2020-10-09 15:54 Alex_Mercer 阅读(381) 评论(0) 推荐(0)
摘要:参考地址 https://www.cnblogs.com/yanbigfeg/p/7346325.html 简单例子 var 找到的对象= 数组对象.find(a=>{return a.对象的属性==i}) 阅读全文
posted @ 2020-06-28 11:49 Alex_Mercer 阅读(6005) 评论(0) 推荐(0)
摘要:参考地址 https://blog.csdn.net/weixin_40902181/article/details/100302528 代码 String.prototype.endWith = function (endStr) { var d = this.length - endStr.le 阅读全文
posted @ 2020-06-02 18:06 Alex_Mercer 阅读(3226) 评论(0) 推荐(0)
摘要:参考链接 https://www.cnblogs.com/jpfss/p/9105119.html 阅读全文
posted @ 2020-05-15 14:53 Alex_Mercer 阅读(646) 评论(0) 推荐(0)
摘要:参考链接 https://www.cnblogs.com/qcloud1001/p/9848619.html 阅读全文
posted @ 2020-05-11 15:45 Alex_Mercer 阅读(230) 评论(0) 推荐(0)
摘要:参考链接 https://www.cnblogs.com/ 原本直接用的是str.replace('old','new'), 在实际的过程中发现,它,竟然只替换一次!!! 全部替换代码:replace(/old/g,'new') ,/g应该就是全部代码了,old那边不需要加引号。如果有特殊字符,则用 阅读全文
posted @ 2020-04-16 15:31 Alex_Mercer 阅读(836) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-03-26 13:00 Alex_Mercer 阅读(8065) 评论(0) 推荐(1)
摘要:高阶函数学习:filter/map/reduce filter:根据条件筛选返回数组 arr=[10,20,30,40,50] arr.filter(n= {return n arr.map(n= {return n 10}) 结果值:[100,200,300,400,500] reduce:对数组 阅读全文
posted @ 2020-03-17 21:36 Alex_Mercer 阅读(269) 评论(0) 推荐(0)
摘要:参考地址: https://blog.csdn.net/fang_ze_zhang/article/details/81868598 正确写法 阅读全文
posted @ 2020-02-14 11:47 Alex_Mercer 阅读(4085) 评论(0) 推荐(0)
摘要:除了对象,数组也可以利用这个方法 阅读全文
posted @ 2020-02-12 09:07 Alex_Mercer 阅读(12676) 评论(0) 推荐(0)
摘要:参考地址 https://blog.csdn.net/zhangshuang92/article/details/54407229/ href执行JS https://blog.csdn.net/bingguang1993/article/details/82747448 异常报错 JS代码如下: 阅读全文
posted @ 2020-02-03 18:19 Alex_Mercer 阅读(751) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-01-17 11:36 Alex_Mercer 阅读(866) 评论(0) 推荐(0)
摘要:来源地址 https://www.cnblogs.com/xi li/p/11107983.html 在js文件的开头,添加下列代码 阅读全文
posted @ 2020-01-03 15:56 Alex_Mercer 阅读(186) 评论(0) 推荐(0)
摘要:来源:https://blog.csdn.net/Raytheon107/article/details/91975043 假设数据是a 1.typeof 返回一个表示数据类型的字符串,返回结果包括:number、boolean、string、symbol、object、undefined、func 阅读全文
posted @ 2019-12-18 11:57 Alex_Mercer 阅读(114) 评论(0) 推荐(0)
摘要:var date=new Date(object类型参数) 阅读全文
posted @ 2019-12-18 11:52 Alex_Mercer 阅读(1166) 评论(0) 推荐(0)
摘要:来源地址:https://www.jb51.net/article/165003.htm // 格式化日期,如月、日、时、分、秒保证为2位数 function formatNumber (n) { n = n.toString() return n[1] ? n : '0' + n; } // 参数 阅读全文
posted @ 2019-12-18 11:49 Alex_Mercer 阅读(6669) 评论(0) 推荐(0)
摘要:本文来自于:https://blog.csdn.net/u014316026/article/details/82057217 个人最喜欢第三种,方便。 1 var ary = ['a', 'b', 'c']; 2 //第一种 3 for (var i in ary) { 4 console.log 阅读全文
posted @ 2019-11-15 10:16 Alex_Mercer 阅读(92) 评论(0) 推荐(0)