vue的调试工具里显示数据已经传过去了,但是我的页面还是一片空白,不知道是什么原因导致的列表页
<router-link
:to="{name:'note_detail',params:{
id:notes_list[index],
}}"
style="font-size:18px;font-weight:bold;color:black">{{note.note_title}}</router-link>详情页接收
<div id="detail">
<h2>标题:{{title}}</h2>
<span>发布时间:{{created_at}}</span>
<div class="content" v-html="note_content"></div>
</div>import note from "./note.vue";
export default {
data(){
return{ title:this.$route.params.id.note_title,
created_at:this.$route.params.id.created_at,
note_content:this.$route.params.id.note_content,
}
},
created(){
this.id = this.$route.params.id;
this.$axios.get('/api/note/checkNote',{
id:this.id,
user_id:this.user_id,
props:{
"id":String
}
}).then((res)=>{
console.log(res.data.checkN);
console.log("详情数据加载完毕")
}).catch(err => console.log(err));
},
methods:{
back(){
this.$route.go(-1)
},
home(){
this.$route.push('/home')
},
},
}
<router-link
:to="{name:'note_detail',params:{
id:notes_list[index],
}}"
style="font-size:18px;font-weight:bold;color:black">{{note.note_title}}</router-link>详情页接收
<div id="detail">
<h2>标题:{{title}}</h2>
<span>发布时间:{{created_at}}</span>
<div class="content" v-html="note_content"></div>
</div>import note from "./note.vue";
export default {
data(){
return{ title:this.$route.params.id.note_title,
created_at:this.$route.params.id.created_at,
note_content:this.$route.params.id.note_content,
}
},
created(){
this.id = this.$route.params.id;
this.$axios.get('/api/note/checkNote',{
id:this.id,
user_id:this.user_id,
props:{
"id":String
}
}).then((res)=>{
console.log(res.data.checkN);
console.log("详情数据加载完毕")
}).catch(err => console.log(err));
},
methods:{
back(){
this.$route.go(-1)
},
home(){
this.$route.push('/home')
},
},
}
props:
[
],
<detail :info="dataInfo"><detail>
...
data () {
return{
dataInfo: {} // 详情页数据
}
}...
详情页
props: {
info: Object
}
<router-link :to="`{name:'note_detail',params:{id:${notes_list[index]}}}`" style="font-size:18px;font-weight:bold;color:black">
{{note.note_title}}
</router-link>