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