07 2021 档案

摘要:1、数组之间无法直接通过 ==或 判断是否相同 解决思路:数组无法直接对比,但字符串可以啊 1) 使用toString() var a = [1, 2, 3]; var b = [1, 2, 3]; console.log(a.toString() b.toString()); //true 但数组 阅读全文
posted @ 2021-07-07 18:00 我咯I 阅读(2847) 评论(0) 推荐(0)
摘要:1、对项目打包文件进行gzip压缩,插件“compression-webpack-plugin”,在vue.config.js中配置 yarn add compression-webpack-plugin -D // 如果报错,就降版本5.0.1 const path = require("path 阅读全文
posted @ 2021-07-05 17:07 我咯I 阅读(208) 评论(0) 推荐(0)
摘要:1、纯数组(不含对象或子数组) var array = [1,2,3,3,4,5]; console.log(Array.from(new Set(array))) //输出 [1, 2, 3, 4, 5] 2、含对象或子数组的 function ret(arr) { const res = []; 阅读全文
posted @ 2021-07-05 15:58 我咯I 阅读(355) 评论(0) 推荐(0)
摘要:1、去除空格 str = str.replace(/\s*/g,''); // 去除字符串内所有的空格 str = str.replace(/^\s*|\s*$/g,''); // 去除字符串内两头的空格 str = str.replace(/^\s*/,''); // 去除字符串内左侧的空格 st 阅读全文
posted @ 2021-07-01 11:45 我咯I 阅读(165) 评论(0) 推荐(0)