• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






chenyongTao

尘世多浮
 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  常用js方法

便于项目进度
 
匹配正则 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 阅读全文
posted @ 2021-04-15 13:53 chenyongTao 阅读(207) 评论(0) 推荐(0)
监测数据类型封装方法
摘要:function typeOf(obj) { let res = Object.prototype.toString.call(obj).split(' ')[1] res = res.substring(0, res.length - 1).toLowerCase() return res } t 阅读全文
posted @ 2021-04-04 16:51 chenyongTao 阅读(65) 评论(0) 推荐(0)
iframe 嵌套html不生效
摘要: 阅读全文
posted @ 2020-10-19 17:01 chenyongTao 阅读(441) 评论(0) 推荐(0)
机密16位
摘要:stringToHex(str) { var val = '' for (var i = 0; i < str.length; i++) { val += '' + str.charCodeAt(i).toString(16) } return val}, 阅读全文
posted @ 2020-10-13 14:14 chenyongTao 阅读(96) 评论(0) 推荐(0)
动态加载js文件
该文被密码保护。
posted @ 2020-06-28 15:38 chenyongTao 阅读(0) 评论(0) 推荐(0)
随机值
该文被密码保护。
posted @ 2020-02-24 12:07 chenyongTao
封装js工具函数
摘要:1、判断数据类型的方法 var type = function(data) { var toString = Object.prototype.toString; var dataType = data instanceof Element ? "element" // 为了统一DOM节点类型输出 阅读全文
posted @ 2020-01-10 13:54 chenyongTao 阅读(271) 评论(0) 推荐(0)
价格单位换算方法
摘要: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 阅读全文
posted @ 2020-01-02 10:11 chenyongTao 阅读(1934) 评论(0) 推荐(0)
数组对象去重 、两个数组对比去除相同项
摘要:数组比较去重 阅读全文
posted @ 2019-12-31 17:14 chenyongTao 阅读(7088) 评论(0) 推荐(0)
单位换算方法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 阅读全文
posted @ 2019-10-29 09:18 chenyongTao 阅读(777) 评论(0) 推荐(0)
数据模板
摘要:asyncData (context) { return obtDetail({ id: context.route.params.id, dynamoSerachType: context.route.query.type }) .then(res => { if (res.data.succes 阅读全文
posted @ 2019-09-29 16:36 chenyongTao
调用接口缓存数据
摘要:mounted () { this.initBtnConfig() }, watch: {}, methods: { async getbBannerBtnConfig () { let res = null try { res = await bannerBt... 阅读全文
posted @ 2019-08-01 15:29 chenyongTao 阅读(909) 评论(0) 推荐(0)
node 版本更新
摘要:1、打开cmd命令窗口,windows键+R,输入cmd确认,打开cmd窗口之后,输入node -v命令,先查看下当前nodejs的版本2、如果上面查看的版本比较低,则可以开始升级清除npm cache3、升级之前还需要安装n模块,n模块是专门用来管理nodejs的版本输入npm install - 阅读全文
posted @ 2019-06-29 10:56 chenyongTao 阅读(12412) 评论(0) 推荐(1)
去除空格
摘要:{ var str=str.replace(/<\/?[^>]*>/gim,"");//去掉所有的html标记 var result=str.replace(/(^\s+)|(\s+$)/g,"");//去掉前后空格 return result.replace(/\s/g,"");//去除文章中间空 阅读全文
posted @ 2019-06-14 14:39 chenyongTao 阅读(201) 评论(0) 推荐(0)
10秒后去某个页面的方法
摘要:data () { return { timer: null }}tenGo () { const TIME_COUNT = 10 if (!this.timer) { this.countTime = TIME_COUNT this.timer = setInterval(() => { if ( 阅读全文
posted @ 2019-05-16 08:37 chenyongTao 阅读(160) 评论(0) 推荐(0)
回到顶部
摘要:立即咨询 集采 ... 阅读全文
posted @ 2019-05-15 16:43 chenyongTao 阅读(198) 评论(0) 推荐(0)
编写一个数组去重的方法?
摘要:function oSort(arr) { varresult ={}; varnewArr=[]; for(vari=0;i<arr.length;i++) { if(!result[arr]) { newArr.push(arr) result[arr]=1 } } returnnewArr } 阅读全文
posted @ 2018-07-08 22:37 chenyongTao 阅读(1222) 评论(0) 推荐(0)