gpt4 book ai didi

javascript - 使用 id 以外的其他值

转载 作者:行者123 更新时间:2023-11-30 05:42:49 25 4
gpt4 key购买 nike

所以,对于 ember,它使用 id 来识别模型,它在 http 请求中也使用它

http://localhost/api/users/12

有没有办法使用不同的值作为它的 id?例如用户名?

结果是这样的......

http://localhost/api/users/john99

最佳答案

原来我不得不这样做

App.ApplicationSerializer = DS.RESTSerializer.extend({
primaryKey: "username"
});

在尝试了很多不同的方法之后,这是唯一有效的方法。

关于javascript - 使用 id 以外的其他值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19792221/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com