随笔分类 -  JavaScript

摘要:安装NVM之后,我们通常会配置镜像,在setting文件中,添加镜像路径 node_mirror: https://npm.taobao.org/mirrors/node npm_mirror: https://npm.taobao.org/mirrors/npm 但是这两天镜像突然炸了,于是我删掉 阅读全文
posted @ 2024-01-30 14:45 迷你胡丶 阅读(976) 评论(0) 推荐(0) 编辑
摘要:字母或数字,默认排序顺序为按字母升序 和 array.reverse() 配合可以实现倒序 array.sort() 在对象数据中,使用函数进行规则配置 var array = [{ num: 4 }, { num: 2 }, { num: 3 }]; // 从小到大 array.sort((a, 阅读全文
posted @ 2023-04-16 21:25 迷你胡丶 阅读(28) 评论(0) 推荐(0) 编辑
摘要:// 获取元素坐标 - left getElementPageLeft(element) { var actualLeft = element.offsetLeft; var parent = element.offsetParent; while (parent != null) { actual 阅读全文
posted @ 2023-02-01 09:29 迷你胡丶 阅读(216) 评论(0) 推荐(0) 编辑
摘要:1、空 /^.+$/ 2、URL /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{ 阅读全文
posted @ 2022-12-23 11:24 迷你胡丶 阅读(21) 评论(0) 推荐(0) 编辑
摘要:1、安装环境依赖 npm install --save html2canvas // 将页面html转换成图片 npm install jspdf --save // 将图片生成pdf 2、自定义PDF转换的函数 // 引入依赖 import Vue from "vue"; import html2 阅读全文
posted @ 2022-12-18 11:02 迷你胡丶 阅读(412) 评论(0) 推荐(0) 编辑
摘要:1、安装依赖 yarn add mqtt 2、引入 import mqtt from 'mqtt' 3、完整项目代码 export default { data() { return { connection: { host: 'xx.xx.xx.xx', port: 8080, connectTi 阅读全文
posted @ 2021-06-24 11:38 迷你胡丶 阅读(641) 评论(0) 推荐(0) 编辑
摘要:1、安装依赖 yarn add stompjs yarn add sockjs-client 2、引入 import Stomp from "stompjs"; import SockJS from "sockjs-client"; 3、完整项目代码 // 其实代码本身自带了心跳,但是有点小问题(忘 阅读全文
posted @ 2021-06-24 11:04 迷你胡丶 阅读(3080) 评论(0) 推荐(1) 编辑
摘要:1、for、forEach、for...of const list = [1,2,3,4,5] list.forEach((item, index, list) => { console.log(item); // 1 2 3 4 5 console.log(index); // 0 1 2 3 4 阅读全文
posted @ 2021-05-28 11:49 迷你胡丶 阅读(376) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示