摘要: JS 金额逗号分隔保留两位小数 //判断是否数字 function isNumber(num) { return (num + "").match(/^[-]?\d+[.]?\d*$/g); } function eraseThousandSplit(num) { num = "" + num; r 阅读全文
posted @ 2024-05-23 20:28 jiazq 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 使用image-conversion实现图片压缩到指定大小 // 导入 import * as imageConversion from 'image-conversion' /** * 压缩小图到100kb */ compressImg(file) { console.log('file: ', 阅读全文
posted @ 2024-05-23 19:58 jiazq 阅读(113) 评论(0) 推荐(0) 编辑
摘要: /** 关闭浏览器窗口 */ closeWindow() { var userAgent = navigator.userAgent if (userAgent.indexOf('Firefox') !== -1 || userAgent.indexOf('Chrome') !== -1) { wi 阅读全文
posted @ 2023-12-11 19:34 jiazq 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 单行 .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } 多行 /* 以两行为例 webkit-line-clamp的值 */ .ellipsis-2 { -webkit-box-orient: 阅读全文
posted @ 2023-12-06 18:54 jiazq 阅读(143) 评论(0) 推荐(0) 编辑
摘要: vue 打开新的Tab页 const router = this.$router.resolve({ path: '/path' }) window.open(router.href, '_blank') resolve中的对象参数和push一样,也可以有name、query、params 阅读全文
posted @ 2023-11-28 20:07 jiazq 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 判断是否有滚动条 const scrollDom = document.getElementById('滚动元素id') if (!scrollDom) return if (scrollDom.clientHeight scrollDom.scrollHeight) { // 没有滚动条 } 判断 阅读全文
posted @ 2023-11-27 19:35 jiazq 阅读(628) 评论(0) 推荐(0) 编辑
摘要: @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { } 阅读全文
posted @ 2023-11-09 20:16 jiazq 阅读(27) 评论(0) 推荐(0) 编辑
摘要: `addEventListener(type, func, opts)` - `type`就是监听的类型,如`scroll`、`touchstart`等; - `func`执行的方法; - `opts`可以是`Boolean`和`Object`; `Boolean`表示什么阶段执行,false:冒泡 阅读全文
posted @ 2023-06-12 19:46 jiazq 阅读(62) 评论(0) 推荐(0) 编辑
摘要: - 使用已有的轮子简单实现H5左右滑动手势 1. 安装`vue2-touch-events` `npm install vue2-touch-events` 2. 在`main.js`中引入 ```js // main.js import Vue2TouchEvents from 'vue2-tou 阅读全文
posted @ 2023-06-12 19:14 jiazq 阅读(333) 评论(0) 推荐(0) 编辑
摘要: div-class为需要添加0.5px边框的元素的类名,下面是less写法,css写法把嵌套的&::after提出来,换成.div-class::after .div-class { position: relative; &::after{ position: absolute; bottom: 阅读全文
posted @ 2023-05-15 20:21 jiazq 阅读(112) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示