我有表中显示的用户列表。活跃用户应该排在非活跃用户之上。
我正在尝试sort
使用 lodashsortBy
函数进行此操作,但未成功。
这是userArray
外观:
const userArray [
{
// I need to show users which have disabled = false first
// and then users with disabled = true
disabled: true, // <==========
email: "hgaither@cmregent.com",
firstName: "Harriet",
lastName: "Gaither",
role: "claimsHandlerSupervisor",
userId: "03VFpxtMWgY1jKDHDLcrWSw1qzx1",
},
{
disabled: false, // <===========
email: "hgaither@cmregent.com",
firstName: "Harriet",
lastName: "Gaither",
role: "claimsHandlerSupervisor",
userId: "03VFpxtMWgY1jKDHDLcrWSw1qzx1",
},
]
这是带有用户数组和 sortBy loadsh 函数的代码笔:https ://codepen.io/nikolatrajkovicq/pen/pGXdpM?editors = 1112
欢迎任何建议。