數據請求,是通過點擊上面的分類(所以分類共用一個數據請求頁面),監控路由變化,只要路由變化就會請求數據,這樣的話頁面請求的數據就緩存不了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也開啟了{
path: '/header',
name: 'Header',
component: Header,
meta:{ keepAlive: false },
children: [
{
path: '/home/:type',
name: 'Home',
component: Home,
meta:{ keepAlive: true }
}
]
},現在還是只要切換分類,頁面就會刷新,不知道該怎么改了
添加回答
舉報
0/150
提交
取消