node.js - 我可以在控制台中看到来自 axios 调用的数据,但它不会在我的视图中呈现(Vuejs)我已经包含了我在控制台中看到的内容(没有错误)
问题描述
这是我要填充的 div 示例。这昨天工作得很好,现在突然间我什么也没看到。我已将我在控制台中看到的内容包含在下面。
<div class="card_title">Win a {{ prizes.name }}</div>
import axios from 'axios'
export default {
name: 'Prizesbyid',
props: {
prizeId: String
},
data () {
return {
prizes: [],
prize: {},
}
},
mounted () {
this.getPrizeById()
},
methods: {
getPrizeById () {
axios.get('http://localhost:3000/prizes/' + this.prizeId).then(response => {
this.prize = response.data.prize
this.name = response.data.name
console.log(response.data)
})
}
}
}
0: {id: 1, name: "Cordoba C5", description: "The Cordoba C5 Classical Guitar is perfect for any…tension, and low action make it a breeze to play.", image_url: "../assets/c5Cor.png", quantity: 5}
1: {id: 2, name: "Merano MC400 Cello", description: "Established in 2000, Merano have made it their mis… fine examples of professional equipment as well.", image_url: "../assets/cello.png", quantity: 3}
2: {id: 3, name: "Guarnerius del Gesu", description: "A repreduction of the most expensive violin in the…e Akiko Meyers, on loan for the rest of her life.", image_url: "../assets/gesu.png", quantity: 7}
3: {id: 4, name: "Japanese Shamisen", description: "The shamisen or samisen, also sangen, is a three-s…d as a suffix, according to regular sound change.", image_url: "../assets/shamisen.png", quantity: 2}
4: {id: 5, name: "Descant Lacewood Lute", description: "One of the most popular lutes is the Descant Lute.… overall length of the Descant Lute is 25 inches.", image_url: "../assets/lute.png", quantity: 2}
5: {id: 6, name: "Russian Balalaika", description: "The balalaika is a Russian stringed musical instru… and the third string is a perfect fourth higher.", image_url: "../assets/balalaika.png", quantity: 9}
6: {id: 7, name: "Pyrophone", description: "A pyrophone is a musical instrument in which notes…ylindrical glass tubes, creating light and sound.", image_url: "../assets/pyrophone.png", quantity: 3}
length: 7
解决方案
推荐阅读
- azure-devops - Azure Devops REST API 删除
- sql - 两个相似数据库中的不同 DISTINCT 行为
- flutter - 想要在完成 2 个函数时运行第三个函数
- python - Python Discord Bot 创建频道
- r - 如何在 OS X 上的 RStudio 中覆盖 ctrl-p 和 ctrl-n?
- python - 匹配字符串到 'pandas._libs.tslibs.timestamps.Timestamp' 对象
- c# - 如何使用 .NET EventHandler 将参数返回到特定变量?
- sql-server - 无法将以下数据插入 MSSQL
- swift - MacOS:SwiftUI:NavigationView:三个视图无法正常工作 - 按钮重复、丢失或闪烁
- node.js - 检索单个对象而不是列表/数组