我一直在尝试使用Axios从对象中提取用户名:有谁可以帮助您?谢谢
[{"id":4,"username":"user1","password":"$2a$14$0/s7FciPuSW.XBtOSG5jUO1iUQwMFWqeboTaPBuFuMFlifI76G0ua","locked":0,"created_at":"2018-08-06 22:08:03"},{"id":5,"username":"user2","password":"$2a$14$QdRO/.mWqUbJV66HciCw3OXIXDKeZH7mcdUBdS9zUaiZNi20bjMi6","locked":0,"created_at":"2018-08-06 22:09:38"},{"id":6,"username":"user3","password":"$2a$14$pMGLWvsDQqM3rll6OX2uE.UgDomGXiFJ8Szz0PyYgr7DQQse6le7u","locked":0,"created_at":"2018-08-06 22:09:51"},{"id":7,"username":"user9","password":"$2a$14$fVJkOyCY992nKjiiJY/aeuAXlgKXHz34cLPNYGFuXMBz4UqPUF3Pu","locked":0,"created_at":"2018-08-07 23:39:57"}]
答案 0 :(得分:0)
这看起来像一个简单的js数组,因此您应该能够执行以下操作。
const users = array.map(e => e.username);
哪个会带走您的项目数组并将其映射到用户名数组中。