1.数组去重方法:
场景:数组中有数字、日期等需要去重的数据
使用:Array.from(new Set(需要去重的数组))
示例:
let result = Array.from(new Set(needDealArray))//结果为Array类型
2.对象属性查找方法:
场景:找对象中有没有指定的属性
使用:object.hasOwnProperty(value)
示例:
let result = val.hasOwnProperty('sizeChang') //结果为boole值
3.对比两个数组之间的差异
场景:需要比较两个数组之间的不同之处
使用:getArrDifference(arr1,arr2)
示例:
getArrDifference(arr1, arr2) {
return arr1.concat(arr2).filter((v, i, arr) => {
return arr.indexOf(v) === arr.lastIndexOf(v);
})
},//返回两数组不同之处 没有返回空数组
4.element中tree样式的修改(注:不生效可以在前加::v-deep进行样式穿透)
.el-tree {
background-color: #2e4056 !important;
color: white !important;
}
.el-tree-node__content:hover {
background: #1e9fff !important;
}
.el-tree-node.is-current > .el-tree-node__content {
background: #1e9fff !important;
}
.el-tree-node:focus > .el-tree-node__content {
background: #1e9fff !important;
}
.el-tree-node__content .el-icon-caret-right:before {
font-size: 18px;
}