cloneDeep 克隆
import { cloneDeep,reduce } from 'lodash';const b = {c:1}const a = cloneDeep(b)
debounce 防抖
import { debounce } from 'lodash';debounce(() => { }, 300, { trailing: true })()
omit方法删除指定属性,返回一个新的对象
import { omit } from 'lodash';var obj= { 'a': 1, 'b': '2', 'c': 3 };//参数一:obj对象//参数二:需删除的属性var result = omit(obj, ['a', 'b']);var resule = omit(obj, function(value, key) {return key === 'a' || key === 'b';})//结果{c:3}
isEqual判断两个对象属性值是否相等
const [newData, setNewData] = useState<any>({});useEffect(() => { if (!isEqual(newData, data)) { setNewData(data) } }, [data]);
来源地址:https://blog.csdn.net/qq_37291053/article/details/132538471