watch: {
$route(to) {
console.log(to)
if (to.path.indexOf('index') != -1) { //路由变化后重新获取帖子列表 this.$http.get('/api/communityList').then((res) => { if (res.data.errCode === 0) { let getRes = res.data.data.hotList this.postList = getRes } }) } } }
转载于:https://www.cnblogs.com/meijiemu/p/9037561.html