<input :placeholder="$t(‘file.search‘)">
1 Object.keys(this.showAddMember) // 查看this.showAddMember的键 2 Object.values(this.showAddMember)// 查看this.showAddMember的值 3 this.showAddMember = { 4 contact:Object 5 4339810:Object(......) 6 4339811:Object(......) 7 }
let site = [‘runoob‘, ‘google‘, ‘taobao‘]; site.includes(‘runoob‘); // true site.includes(‘baidu‘);// false
Array.from(new Set(serverList))
npm install ramraf -g (安装)
rimraf node_modules (指令)
tip:node_modules是要删除的文件或文件夹,按tab有文件名称补全功能
overflow: hidden; // 超出部分隐藏 text-overflow: ellipsis; // 超出部分显示省略号 white-space: nowrap; // 规定段落中的文本不进行换行 width: 100px; //需要配合宽度来使用,否则无效
width: 500px; overflow: hidden; text-overflow: ellipsis; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical;
overflow:overlay;
var presonArr = [ { name:‘freddy‘, age:24, score:97 }, { name:‘nick‘, age:18, score:87 }, { name:‘mike‘, age:26, score:80 }, { name:‘james‘, age:34, score:90 }, { name:‘curry‘, age:30, score:83 } ]; presonArr.sort(function(a,b){ return a.age - b.age; }); console.log(presonArr);
JSON.parse() var jsonStr = ‘{"key":"value"}‘; //只能转换jsonStr这种 var jsonStr1 = ‘{key:"value"}‘; console.log(JSON.parse(jsonStr)); // 结果:{key: "value"} console.log(JSON.parse(jsonStr1)); // 结果:Unexpected token k in JSON at position 1 at JSON.parse (<anonymous>) 2.eval() var jsonStr = ‘{"key":"value"}‘; var jsonStr1 = ‘{key:"value"}‘; console.log(eval(‘(‘ + jsonStr + ‘)‘)); // 结果:{key: "value"} console.log(eval(‘(‘ + jsonStr1 + ‘)‘)); // 结果:{key: "value"}
console.log(new Date().getTime())
taskkill /im node.exe /f
computedFileSize(preSize) { // 计算文件大小 const unitArr = [‘B‘, ‘KB‘, ‘MB‘, ‘GB‘, ‘TB‘, ‘PB‘, ‘EB‘, ‘ZB‘, ‘YB‘]; let index = 0; const srcsize = parseFloat(preSize); index = Math.floor(Math.log(srcsize) / Math.log(1024)); let size = srcsize / 1024 ** index; size = size.toFixed(1); return size + unitArr[index]; },
一些平常会用到的前端小代码(VUE CLI环境下),持续更新......
原文:https://www.cnblogs.com/caocaiqi/p/12892346.html