🐛 消息中心分页问题修复
This commit is contained in:
parent
a3301e5936
commit
af361e297e
@ -48,7 +48,7 @@
|
||||
computed: {
|
||||
...mapState('global', []),
|
||||
isPostArticle() {
|
||||
if (this.$route.name == 'article-post-article_id') {
|
||||
if (this.$route.name === 'article-post-article_id') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -92,7 +92,7 @@
|
||||
.el-main {
|
||||
padding: 0;
|
||||
background-attachment: fixed;
|
||||
min-height: 87.5vh;
|
||||
min-height: 85vh;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
|
@ -17,13 +17,18 @@
|
||||
components: {
|
||||
NotificationList
|
||||
},
|
||||
fetch({store, error}) {
|
||||
fetch({store, query, error}) {
|
||||
return Promise.all([
|
||||
store
|
||||
.dispatch('notification/fetchList')
|
||||
.dispatch('notification/fetchList', {page: query.page || 1})
|
||||
.catch(err => error({statusCode: 404}))
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
'$route.query': function () {
|
||||
this.$store.dispatch('notification/fetchList', {page: this.$route.query.page || 1})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
notifications: state => state.notification.list.data,
|
||||
@ -32,8 +37,11 @@
|
||||
},
|
||||
methods: {
|
||||
currentChangeNotification(page) {
|
||||
this.$store.dispatch('notification/fetchList', {
|
||||
page: page
|
||||
this.$router.push({
|
||||
name: 'notification',
|
||||
query: {
|
||||
page: page
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -28,10 +28,16 @@ export const mutations = {
|
||||
|
||||
export const actions = {
|
||||
// 获取消息列表
|
||||
fetchList({commit}, params = {}) {
|
||||
fetchList({commit, state}, params = {}) {
|
||||
// 清空已有数据
|
||||
commit('updateListData', getDefaultListData())
|
||||
commit('updateListFetching', true)
|
||||
// 当前页判断
|
||||
let currentData = JSON.parse(JSON.stringify(state)).list.data
|
||||
if (Number(params.page) === currentData.pagination.currentPage) {
|
||||
commit('updateListFetching', false)
|
||||
return
|
||||
}
|
||||
commit('updateListData', getDefaultListData())
|
||||
let data = {
|
||||
page: params.page || 1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user