随笔分类 - js
摘要:1、url参数转对象 /** * @param {string} url * @returns {Object} */ // 方法一: function param2Obj(url) { const search = decodeURIComponent(url.split("?")[1]).rep
阅读全文
摘要:Date.prototype.Format = function (fmt) { // author: meizz var o = { "M+": this.getMonth() + 1, // 月份 "d+": this.getDate(), // 日 "h+": this.getHours(),
阅读全文
摘要:function getRandomNum(min, max) { // +1 包含最大值 return Math.floor(Math.random() * (max-min + 1)) + min; }
阅读全文
摘要:1、不以 "hello" 开头 /^(?!hello.*)/ 2、不以 "(hello)" 开头 /^(?![\(\(]hello[\)\)]).*/ 注:^是字符串开头,(?! ) 是正向否定预查,简单说,以 xxx(?!pattern)为例,就是捕获不以pattern结尾的内容xxx php 去
阅读全文
摘要:let canvas = document.createElement("canvas"); let img = document.getElementById('img'); canvas.width = img.width; canvas.height = img.height; let ctx
阅读全文