摘要: 阅读全文
posted @ 2021-01-18 12:21 _ryze 阅读(40) 评论(0) 推荐(0) 编辑
摘要: document.selection.createRange() 根据当前文字选择返回 TextRange 对象,或根据控件选择返回 ControlRange 对象。 配合 execCommand,在 HTML 编辑器中很有用,比如:文字加粗、斜体、复制、粘贴、创建超链接等。 实例一: <texta 阅读全文
posted @ 2021-01-15 15:33 _ryze 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 方法一:# function copyHandle(content){ let copy = (e)=>{ e.preventDefault() e.clipboardData.setData('text/plain',content) alert('复制成功') document.removeEv 阅读全文
posted @ 2021-01-15 15:27 _ryze 阅读(368) 评论(0) 推荐(0) 编辑
摘要: /** * 下载图片类 */export class DownloadImg { /** * 下载图片 * @param url */ public static downloadImg(url: string) { this.convertUrlToBase64(url).then(res => 阅读全文
posted @ 2021-01-15 15:14 _ryze 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 聊天使用websocket 结合vuex做的 消息体的类型 单文本 表情 组合 引用 以及发送消息的状态 padding sucess error后台返回chatlist(聊天记录)里面每条消息都有type(根据type判断消息,头像,名字),还有消息体,以及创建时间(createTIme)需求参考 阅读全文
posted @ 2020-11-28 14:15 _ryze 阅读(1104) 评论(0) 推荐(0) 编辑
摘要: Math常用方法 方法名功能 abs(x) 返回 x 的绝对值。 ceil(x) 对数进行上舍入。 floor(x) 对 x 进行下舍入。 max(x,y,z,...,n) 返回 x,y,z,...,n 中的最高值。 min(x,y,z,...,n) 返回 x,y,z,...,n中的最低值。 pow 阅读全文
posted @ 2020-05-08 19:10 _ryze 阅读(209) 评论(0) 推荐(0) 编辑
摘要: // 数值补零 function createZero(n){ if(n<10){ return "0"+n; } return n; } //字符补零 function createZero(n){ if(n.length < 2){ return "0" + n } return n; } fu 阅读全文
posted @ 2020-05-08 19:04 _ryze 阅读(334) 评论(0) 推荐(0) 编辑
摘要: // var num = 234; // console.log(num); // var er = num.toString(2); // console.log(er); // var ba = num.toString(8); // console.log(ba); // var sl = n 阅读全文
posted @ 2020-05-08 18:53 _ryze 阅读(1143) 评论(0) 推荐(0) 编辑
摘要: //random() 方法可返回介于 0 ~ 1 之间的一个随机数。 //生成最小min到最大max的随机数 function random(min,max){ if(min > max){ var ls = min; min = max; max = ls; } return Math.floor 阅读全文
posted @ 2020-05-08 18:51 _ryze 阅读(573) 评论(0) 推荐(0) 编辑
摘要: function getMax(abc){ // 1.要深拷贝数组 abc = abc.slice(0); // 2.排序(升序第一个值是最小值,降序第一个值是最大值) abc.sort(function(a,b){return b-a}); // 3.返回第一个值 return abc[0]; } 阅读全文
posted @ 2020-05-08 18:45 _ryze 阅读(422) 评论(0) 推荐(0) 编辑