匹配正则 url 端口 域名
摘要:var url = "http://192.168.0.61:8080/touch/index.html?game=AB01";var reg = new RegExp(/(\w+):\/\/([^/:]+)(:\d*)?/)var result = url.match(reg);console.l
阅读全文
监测数据类型封装方法
摘要:function typeOf(obj) { let res = Object.prototype.toString.call(obj).split(' ')[1] res = res.substring(0, res.length - 1).toLowerCase() return res } t
阅读全文
机密16位
摘要:stringToHex(str) { var val = '' for (var i = 0; i < str.length; i++) { val += '' + str.charCodeAt(i).toString(16) } return val},
阅读全文
封装js工具函数
摘要:1、判断数据类型的方法 var type = function(data) { var toString = Object.prototype.toString; var dataType = data instanceof Element ? "element" // 为了统一DOM节点类型输出
阅读全文
价格单位换算方法
摘要:function price (val,types, isNoUnpin, customModel) { let type = types if(!val || isNaN(Number(val))) { if (isNoUnpin) return type ? '0':'0.00' else return type ? '0万元':'0.00元' } else { if (customModel
阅读全文
单位换算方法k、bk、。。。。
摘要:bytesToSize (bytes) { if (bytes 0) return '0B' var symbols = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] var exp = Math.floor(Math.log(b
阅读全文
数据模板
摘要:asyncData (context) { return obtDetail({ id: context.route.params.id, dynamoSerachType: context.route.query.type }) .then(res => { if (res.data.succes
阅读全文
调用接口缓存数据
摘要:mounted () { this.initBtnConfig() }, watch: {}, methods: { async getbBannerBtnConfig () { let res = null try { res = await bannerBt...
阅读全文
node 版本更新
摘要:1、打开cmd命令窗口,windows键+R,输入cmd确认,打开cmd窗口之后,输入node -v命令,先查看下当前nodejs的版本2、如果上面查看的版本比较低,则可以开始升级清除npm cache3、升级之前还需要安装n模块,n模块是专门用来管理nodejs的版本输入npm install -
阅读全文
去除空格
摘要:{ var str=str.replace(/<\/?[^>]*>/gim,"");//去掉所有的html标记 var result=str.replace(/(^\s+)|(\s+$)/g,"");//去掉前后空格 return result.replace(/\s/g,"");//去除文章中间空
阅读全文
10秒后去某个页面的方法
摘要:data () { return { timer: null }}tenGo () { const TIME_COUNT = 10 if (!this.timer) { this.countTime = TIME_COUNT this.timer = setInterval(() => { if (
阅读全文
编写一个数组去重的方法?
摘要:function oSort(arr) { varresult ={}; varnewArr=[]; for(vari=0;i<arr.length;i++) { if(!result[arr]) { newArr.push(arr) result[arr]=1 } } returnnewArr }
阅读全文