随笔分类 -  js

摘要:除了strong、em、p、u标签,其他标签全部清除 str = str.replace(/<(?!\/?strong|\/?em|\/?p|\/?u)[^<>]*>/ig,'') 阅读全文
posted @ 2020-10-23 11:21 龙卷风吹毁停车场 阅读(1420) 评论(0) 推荐(0)
摘要:以最简单的方法解决未找到图片之后的逻辑处理,不管是重新选择图片地址还是弹出消息提示 html部分 <img :src="URL" alt="" @error="imgError"> imgError(){ alter('图片未找到404!'); //如果需要重新设置图片地址可以在此处写其他逻辑,重新 阅读全文
posted @ 2020-07-01 17:12 龙卷风吹毁停车场 阅读(3316) 评论(0) 推荐(0)
摘要:我出现这个错误的原因是:我使用localStorage或者sessionStorage存入本地数据时, 存入了一个值为 Undefined ,当我在去取出来转换为JSON对象的时候,就是出现 Unexpected token u in JSON at position 0 报错 所以,当你存入数据和 阅读全文
posted @ 2020-06-03 15:33 龙卷风吹毁停车场 阅读(62053) 评论(0) 推荐(5)
摘要:/** * @author 龙卷风 * @description 将时间戳转换为年-月-日-时-分-秒格式 * @param {Number} timestamp 时间戳,单位为秒或毫秒 * @param {Number} type 转换类型,1为完整日期时间格式,2为年月日格式,默认为1 * @r 阅读全文
posted @ 2020-05-08 17:53 龙卷风吹毁停车场 阅读(7919) 评论(0) 推荐(0)
摘要:/** * @description 判断用户输入的网址是否合法 * @param {String} str_url * @returns {Boolean} 返回true表示地址合法 */ function IsURL(str_url) { var strRegex = "^((https|htt 阅读全文
posted @ 2020-04-28 10:50 龙卷风吹毁停车场 阅读(724) 评论(0) 推荐(0)
摘要:var data = []; var str = []; this.content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, function (match, capture) { data.push(capture); str.push(match) 阅读全文
posted @ 2020-04-27 14:30 龙卷风吹毁停车场 阅读(4144) 评论(0) 推荐(0)
摘要:直接拷贝过去就能直接使用,无需改动 我在我的项目文件assets中新建了一个tool.js的文件用来存放公共的方法 1、tool.js的文件内容如下 /** * @author xxxx * @description 保存cookie * @param {String} name 需要存储cooki 阅读全文
posted @ 2020-04-16 15:15 龙卷风吹毁停车场 阅读(1217) 评论(0) 推荐(0)
摘要:转载于:http://www.west999.com/info/html/wangyezhizuo/Javascript/20180624/4232973.html 取消这两处的勾选 阅读全文
posted @ 2020-01-09 10:16 龙卷风吹毁停车场 阅读(587) 评论(0) 推荐(0)
摘要:var now = new Date(); // 当前日期 var nowDayOfWeek = now.getDay(); // 今天本周的第几天 var nowDay = now.getDate(); // 当前日 var nowMonth = now.getMonth(); // 当前月 va 阅读全文
posted @ 2019-12-31 14:20 龙卷风吹毁停车场 阅读(2807) 评论(0) 推荐(1)
摘要:第一种方法:需要安装一个模块 yarn add image-conversion --save <el-upload ref="upload" :data="date" :action="URL+'/api/post/file'" :before-upload="beforeAvatarAUDIO3 阅读全文
posted @ 2019-12-12 21:32 龙卷风吹毁停车场 阅读(5071) 评论(2) 推荐(0)
摘要:直接上代码,复制开用 let regExp = /^([0-9]{3,4}\-)?[0-9]{7,8}$|^0?1[3|4|5|7|8|9][0-9]\d{8}$/; //验证的手机号码格式 //this.ruleForm.adminContactNumbers是拿到的手机号 if(!regExp. 阅读全文
posted @ 2019-11-26 15:15 龙卷风吹毁停车场 阅读(427) 评论(0) 推荐(0)
摘要:替换 str是我要查询的内容loot.SERVE.file 是要被替换的内容g 全局替换"" 去替换的内容,我这里是空str.replace(new RegExp(loot.SERVE.file,'g'),""); 插入 str是要替换的内容 loot.SERVE.file 是我要被替换的内容 g 阅读全文
posted @ 2019-10-26 15:31 龙卷风吹毁停车场 阅读(1448) 评论(0) 推荐(0)
摘要:以element-ui中messageBox弹出框为例 接收返回值 阅读全文
posted @ 2019-10-19 10:16 龙卷风吹毁停车场 阅读(910) 评论(1) 推荐(0)
摘要:注:此方法是使用hbuilderx云打包之后才能用,否则在浏览器中会报 plus is not defined 官方文档 http://www.html5plus.org/doc/zh_cn/gallery.html#plus.gallery.save http://www.html5plus.or 阅读全文
posted @ 2019-08-07 18:00 龙卷风吹毁停车场 阅读(2647) 评论(0) 推荐(0)
摘要:export default { data(){ return{ date:[] } }, methods:{ async getInitialUsers(){ let res = await get_message.get('http://localhost:3000/json') this.da 阅读全文
posted @ 2019-06-27 14:50 龙卷风吹毁停车场 阅读(417) 评论(0) 推荐(1)