【发布时间】:2018-12-13 15:13:54
【问题描述】:
所以我有 2 个不同的 JSON。 书籍
{
"books": [{
"name": "Lord of the rings",
"author": 1,
"year": 1937,
"genre": 3,
"imageUrl": "https://cdn.lifehack.org/wp-content/uploads/2015/03/9780618640157_custom-s6-c30.jpg",
"availability": true
}]
}
还有一个,作者
{
"authors": [{
"id": 1,
"name": "J.R.R. Tolkien"
}, {
"id": 2,
"name": "Harper Lee"
}, {
"id": 3,
"name": "J.K. Rowling"
}]
}
我想让作者像一个 id,所以当我显示一本书的作者时,我想要的是名字(在第二个 json 中),而不是 id。 我怎样才能做到这一点? 不确定是否重要,但我在 VUE 工作。
【问题讨论】: