【发布时间】:2019-08-03 15:39:48
【问题描述】:
我有一个项目列表,其中标题是显示项目详细视图的链接。单击标题,它会正确转到 url + Id。在 Vue 收费中,详细信息页面检索具有匹配 ID 但作为数组而不是对象的项目,并且模板不显示任何属性 - 我错过了什么?
<script>
import axios from "axios";
export default {
name: "Report",
data() {
return {
report: {}
};
},
mounted: function() {
this.getReport();
},
methods: {
getReport() {
let uri = "http://localhost:5000/api/reports/" + this.$route.params.id;
axios.get(uri).then(response => {
this.report = response.data;
});
}
}
};
</script>
模板就是这样
<template>
<v-content>
<h1>report detail page</h1>
<p>content will go here</p>-
<h3>{{ report.month }}</h3>
<pre>{{ report._id }}</pre>
</v-content>
</template>
感谢任何cmets
【问题讨论】: