數(shù)據(jù)請求,是通過點(diǎn)擊上面的分類(所以分類共用一個(gè)數(shù)據(jù)請求頁面),監(jiān)控路由變化,只要路由變化就會請求數(shù)據(jù),這樣的話頁面請求的數(shù)據(jù)就緩存不了watch: {
$route: function() { // if (this.routerChange) {
this.getNews() // }
}
},
methods: {
...mapActions(['getList', 'dowmLoadmore']),
getFirstNews(){ this.getList({
channel: this.firstName,
type: this.firstType,
flag: this.routerChange
})
},
getNews() { this.getList({
channel: this.$route.query.type,
type: this.$route.params.type,
flag: this.routerChange
})keep-alive也開啟了{(lán)
path: '/header',
name: 'Header',
component: Header,
meta:{ keepAlive: false },
children: [
{
path: '/home/:type',
name: 'Home',
component: Home,
meta:{ keepAlive: true }
}
]
},現(xiàn)在還是只要切換分類,頁面就會刷新,不知道該怎么改了
添加回答
舉報(bào)
0/150
提交
取消