争渡,争渡,惊起一滩鸥鹭

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
  124 随笔 :: 0 文章 :: 0 评论 :: 97547 阅读

随笔分类 -  js

摘要:百分数转化为小数 function toPoint(percent){ var str=percent.replace("%",""); str= str/100; return str; } 小数转化为百分数 function toPercent(point){ var str=Number(po 阅读全文
posted @ 2022-03-26 20:55 争渡~ 阅读(574) 评论(0) 推荐(0) 编辑

摘要:做项目时,需求是关闭一个页面后,下一个页面(指定两种页面,主页和待办)自动刷新数据 两种写法,都是定位iframe的id, 第一种,定位iframe的id后,通过window挂载函数和触发进行通信 第二种,直接定位iframe绑定id,进行刷新 阅读全文
posted @ 2022-01-25 20:39 争渡~ 阅读(374) 评论(0) 推荐(0) 编辑

摘要: 阅读全文
posted @ 2022-01-25 20:23 争渡~ 阅读(84) 评论(0) 推荐(0) 编辑

摘要:selectPhoneNumber(str) { var regx = /(1[3|4|5|7|8][\d]{9}|0[\d]{2,3}-[\d]{7,8}|400[-]?[\d]{3}[-]?[\d]{4})/g; var phoneNums = str.match(regx); if (phon 阅读全文
posted @ 2021-07-01 15:56 争渡~ 阅读(1099) 评论(0) 推荐(0) 编辑

摘要:parseFloat() 解析一个字符串并返回一个浮点数。 parseInt() 解析一个字符串并返回一个整数。 阅读全文
posted @ 2020-11-21 12:27 争渡~ 阅读(106) 评论(0) 推荐(0) 编辑

摘要:continue: 在循环中,效果是跳过本次循环进行下一次循环。 break: 在循环中,作用是跳出循环。 return: 在循环中,作用是结束本次循环。 参考文档: https://www.cnblogs.com/sghy/p/7827255.html 参考文档: https://blog.csd 阅读全文
posted @ 2020-11-12 20:29 争渡~ 阅读(1417) 评论(0) 推荐(0) 编辑

摘要:Array.isArray() 用于确定传递的值是否是一个 Array。 concat() 方法用于合并两个或多个数组。此方法不会更改现有数组,而是返回一个新数组。 find() 方法返回数组中满足提供的测试函数的第一个元素的值。否则返回 undefined。 findIndex()方法返回数组中满 阅读全文
posted @ 2020-11-10 20:25 争渡~ 阅读(554) 评论(0) 推荐(0) 编辑

摘要:includes() 方法用于判断一个字符串是否包含在另一个字符串中,根据情况返回 true 或 false。 indexOf() 方法返回调用它的 String 对象中第一次出现的指定值的索引,从 fromIndex 处进行搜索。如果未找到该值,则返回 -1。 slice() 方法提取某个字符串的 阅读全文
posted @ 2020-11-08 19:08 争渡~ 阅读(85) 评论(0) 推荐(0) 编辑

摘要:JSON.parse() JSON.parse() 方法用于将一个 JSON 字符串转换为对象。 JSON.stringify() JSON.stringify() 方法用于将 JavaScript 对象或值转换为 JSON 字符串。 参考文档:https://developer.mozilla.o 阅读全文
posted @ 2020-11-08 17:11 争渡~ 阅读(763) 评论(0) 推荐(0) 编辑

摘要:通过 Object.keys(obj).length 是否为零来判断对象是否为空 阅读全文
posted @ 2020-11-03 19:42 争渡~ 阅读(90) 评论(0) 推荐(0) 编辑

摘要:function函数传过来的参数名,不能再定义,会报错 除非取一个不同的名字进行赋值 除非不定义,参数可以直接用 (也就是当成已经被定义过了) 阅读全文
posted @ 2020-11-02 22:30 争渡~ 阅读(164) 评论(0) 推荐(0) 编辑

摘要:for(let i=0;array.length>0;i++)只能遍历数组 for(let i in array)除了能遍历数组,还能遍历对象 阅读全文
posted @ 2020-11-02 22:05 争渡~ 阅读(448) 评论(0) 推荐(0) 编辑

摘要:// 判断当前时间是否在某一时间段 timeRange(beginTime, endTime) { let strb = beginTime.split(":"); if (strb.length != 2) { return false; } let stre = endTime.split(": 阅读全文
posted @ 2020-11-02 20:17 争渡~ 阅读(934) 评论(0) 推荐(0) 编辑

摘要:这是我做react项目写的 <input defaultValue={orderDetail["orderAliasCode"] || ""} ref="orderNumCopy" className="copy-value"></input> <div onClick={this.copyCont 阅读全文
posted @ 2020-10-25 19:02 争渡~ 阅读(152) 评论(0) 推荐(0) 编辑

摘要:concat() 方法用于连接两个或多个数组。 该方法不会改变现有的数组,而仅仅会返回被连接数组的一个副本。 let a = [1,2,3]; let b = [4,5]; let c = a.concat(b); console.log(c); // [1,2,3,4,5] 阅读全文
posted @ 2020-04-08 19:57 争渡~ 阅读(167) 评论(0) 推荐(0) 编辑

摘要:Object.assign方法用于对象的合并,将源对象(source)的所有可枚举属性,复制到目标对象(target)。 const target = { a: 1, b: 1 }; const source1 = { b: 2, c: 2 }; const source2 = { c: 3 }; 阅读全文
posted @ 2020-04-08 19:37 争渡~ 阅读(143) 评论(0) 推荐(0) 编辑

摘要:cookie: 1.定义:什么是cookie? cookie就是存储在客户端的一小段文本 2.cookie是一门客户端的技术,因为cookie是存储在客户端浏览器中的 3.cookie的作用:是为了实现客户端与服务器之间状态的保持 4.cookie 技术不安全,不要使用cookie保存敏感信息 5. 阅读全文
posted @ 2020-04-07 19:59 争渡~ 阅读(159) 评论(0) 推荐(0) 编辑

摘要:let currentDate = "2019-04"; currentDate = new Date(currentDate); // 将日期格式转换为 Mon Apr 01 2019 08:00:00 GMT+0800 (中国标准时间) // 月份加一 let lastDate = curren 阅读全文
posted @ 2020-04-07 19:17 争渡~ 阅读(7659) 评论(0) 推荐(1) 编辑

摘要:js常用的几种创建对象的方式有: {} new Object() 使用字面量 工厂模式 构造函数模式(constructor) 原型模式(prototype) 构造函数+原型模式 这里只举例我自己常用的两种吧 /** 使用{}创建对象,等同于 new Object(); **/ var o = {} 阅读全文
posted @ 2020-03-24 20:42 争渡~ 阅读(144) 评论(0) 推荐(0) 编辑

摘要:数组合并 // 数组合并 var array1 = [1, 2, 3]; var array2 = [4, 5, 6]; var array3 = [...array1, ...array2, 7, 8]; //[1,2,3,4,5,6,7,8] array1.push(...array2 )// 阅读全文
posted @ 2020-03-19 19:36 争渡~ 阅读(1718) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示