摘要: 使用indexOf方法去重 function unique (arr){ if(!Array.isArray(arr)){ return } let array = [] arr.forEach(item => { if(array.indexOf(item) -1){ array.push(ite 阅读全文
posted @ 2021-11-01 22:10 YAN-YAN 阅读(29) 评论(0) 推荐(0)
摘要: 判断给定的对象是不是数组的四个方法 instanceof方法 判断一个对象是否在其原型链原型构造函数的属性 constructor方法 constructor属性返回创建此对象的构造函数 Object.prototype.toString.call(xxx) isArray() const arr 阅读全文
posted @ 2021-11-01 20:46 YAN-YAN 阅读(30) 评论(0) 推荐(0)
摘要: <el-input v-model="testData" @keydown.native="checkNumber"></el-input> 只能使用keydown或者keyup事件 checkNumber(e) { // 此处可以自行定义正则规则 const reg = /^[1-9]\d*$/; 阅读全文
posted @ 2021-11-01 18:32 YAN-YAN 阅读(1303) 评论(0) 推荐(0)