返回排序回调函数(支持中文,不支持一级数据与混合类型。)
排序的字段
是否升序
sortCallBack('createDt', true); /// 按照 createDt 升序排列const arr = [{name: '666'}, {name: '333'}]arr.sort(sortCallBack('name')); /// [{name: '333'}, {name: '666'}]arr.sort(sortCallBack('name', false)); /// [{name: '666'}, {name: '333'}] Copy
sortCallBack('createDt', true); /// 按照 createDt 升序排列const arr = [{name: '666'}, {name: '333'}]arr.sort(sortCallBack('name')); /// [{name: '333'}, {name: '666'}]arr.sort(sortCallBack('name', false)); /// [{name: '666'}, {name: '333'}]
返回排序回调函数(支持中文,不支持一级数据与混合类型。)