版权声明:本文为QQ帝国原创博客,非经本人同意,且勿转载。。 https://blog.csdn.net/QQ_Empire/article/details/84673194
当点击collection()这个方法的时候,跳转并带上标识,
collection() {
this.$router.push({path: 'notSee', query: { id: '1' }});
},
然后在组件中通过判断query.id来加载不同的数据进去
getDataList() {
const queryId = this.$route.query.id;
this.$http.get('api/all').then((response) => {
response = response.data.data;
if (queryId === '1') {
this.publicData = response.collection[0];
} else if (queryId === '2') {
this.publicData = response.hot[0];
}
});
}