我有一個包含一些對象的 JSON 文件,這些對象是使用計算屬性渲染出來的JSON:{ "id": 6, "formula": "2+2", "description": "Just a description.", "image": "../assets/img/id6.png", "answers": [ { "answerId": 0, "answerInput": "Funktion", "correct": false}, { "answerId": 1, "answerInput": "Relation", "correct": true} ]}所有數(shù)據(jù)均已正確呈現(xiàn)。腳本標(biāo)簽:computed:{ filterById(){ return this.exercises.find(exercises => exercises.id === this.exId) } }模板標(biāo)簽:<div class="task-description"> <h2>{{ filterById.description }}</h2> <img :src="`${filterById.image}`" alt=""></div>但由于某種原因我無法渲染圖像,我確信圖像的路徑是正確的。
在 Vue.JS 中使用計算屬性 v-bind 圖像 src
陪伴而非守候
2023-08-24 15:45:06