the specific code is as follows
<template>
<div class="detail">
<dl v-for="(list,index) in detailData" :key="index">
<dt>
<img :src="list.avatar">
</dt>
<dd>
<h2>{{list.title}}</h2>
</dd>
</dl>
</div>
</template>
<script>
import axios from "axios";
export default {
name: "detail",
data() {
return {
id: 0,
allData: [],
detailData: []
}
},
mounted() {
this.id = this.$route.params.id;
// console.log(this.id)
axios.get("/api").then(res => {
this.allData = this.allData.push(res.data);
console.log(this.allData)
this.detailData = this.allData.filter((v, i) => {
// console.log(this.detailData)
return v.id == this.id;
});
})
},
}
</script>
print console.log (this.allData) should be input received Json data, but print result is 1;
No error was reported in the service, and id also got