随笔分类 -  js

摘要:方案:将html文本里面的图片地址保留起来,然后做一个长按/双击事件,放手后进行预览图片地址(缺点:无法确定长按的是那一张,全部展示) html <view class="text-content" style="max-height: max-content;"> <!-- 双击 --> <ric 阅读全文
posted @ 2024-01-04 15:35 小杨观世界 阅读(397) 评论(0) 推荐(0) 编辑
摘要:1、npm 安装插件 npm install -S uuid 2、生成随机字符串import { v4 as uuidv4 } from 'uuid' 3、用uuidv4()获取随机生成的字符串 sign.value = uuidv4(); 阅读全文
posted @ 2023-06-28 09:21 小杨观世界 阅读(106) 评论(0) 推荐(0) 编辑
摘要:解决方式一: tsconfig.json里添加 "forceConsistentCasingInFileNames":false 解决方式二:https://github.com/ant-design/pro-components/issues/6592#issuecomment-150135654 阅读全文
posted @ 2023-06-21 09:01 小杨观世界 阅读(3077) 评论(1) 推荐(2) 编辑
摘要:.wrapper { background: #50a3a2; background: -webkit-linear-gradient(top left, #50a3a2 0%, #53e3a6 100%); background: linear-gradient(to bottom right, 阅读全文
posted @ 2023-03-13 10:55 小杨观世界 阅读(177) 评论(0) 推荐(0) 编辑
摘要:moment.parseZone('2023-01-11T16:54:31.6864601').utc().format('YYYY-MM-DD HH:mm:ss') 文档 | Moment.js 中文网 (momentjs.cn) 阅读全文
posted @ 2023-03-03 15:56 小杨观世界 阅读(65) 评论(0) 推荐(0) 编辑
摘要://num1 num2传入两个值 symbol +-*/符号 amend(num1,num2,symbol){ var str1=num1.toString(),str2=num2.toString(),result,str1Length,str2Length //解决整数没有小数点方法 try { 阅读全文
posted @ 2022-09-16 11:11 小杨观世界 阅读(150) 评论(0) 推荐(0) 编辑
摘要://复制内容 function copyVal(value) { navigator.clipboard.writeText(value); // navigator.clipboard.writeText(value).then(() => {}); } 阅读全文
posted @ 2022-07-20 10:18 小杨观世界 阅读(107) 评论(0) 推荐(0) 编辑
摘要:向下取整:Math.floor() 向上取整:Math.ceil() 四舍五入:Math.round() 保留一位有效数字:num.toFixed(1) 保留一位: Math.round(19.0909 * 10)/10 阅读全文
posted @ 2022-05-30 23:19 小杨观世界 阅读(734) 评论(0) 推荐(0) 编辑
摘要:// 两种获取方法 function GetQueryString(parameter) { var reg = new RegExp("(^|&)" + parameter + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).m 阅读全文
posted @ 2021-10-27 14:35 小杨观世界 阅读(491) 评论(0) 推荐(0) 编辑