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

浙公网安备 33010602011771号