小七来了

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

随笔分类 -  各种js校验规则

多个form表单同时校验
摘要:1.新建mulitipleFormValid.js /** * 多个表单同时校验 * @param {*} formRefs * @returns */ const validateForms = (formRefs) => { let objectList = []; let results = 阅读全文

posted @ 2024-02-22 15:15 小七来了 阅读(154) 评论(0) 推荐(0) 编辑

el-form表单使用pattern自定义校验规则
摘要://正则校验的正则表达式,这里注意正则表达式中的‘\’要使用‘\\’转义 const patterns = { "name":"^[a-zA-Z_][0-9a-zA-Z_]{0,}$", "tel":"^1[2-9]\\d{0,}$", "email":"^\\w+([-+.]\\w+)*@\\w+ 阅读全文

posted @ 2024-02-22 14:50 小七来了 阅读(284) 评论(0) 推荐(0) 编辑

页面滚动点击返回至顶部,js怎么实现
摘要:当页面要滚回顶部时,使用scrollTop属性,设置值为0即可 当页面具有 DOCTYPE,或者说指定了 DOCTYPE 时,使用document.documentElement.scrollTop。 当页面不具有 DOCTYPE,或者说没有指定了 DOCTYPE 时,使用document.body 阅读全文

posted @ 2023-12-04 10:00 小七来了 阅读(743) 评论(0) 推荐(0) 编辑

手机、email、数字、卡号、邮编、身份证、邮箱、微信号、中文字母等校验
摘要:// 正整数不能以0开头,可写范围即数字位数长度 function int_number(number, min = 0, max = '') { const str = new RegExp(`^[1-9]\\d{${min},${max}}$`) return regTel .test(numb 阅读全文

posted @ 2023-11-08 14:08 小七来了 阅读(46) 评论(0) 推荐(0) 编辑

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