Fix maintaining the current page for the list view when navigating back from another page
This commit is contained in:
parent
cc02fc82fc
commit
588b87fb96
3 changed files with 7 additions and 2 deletions
|
@ -59,6 +59,7 @@
|
|||
auth.user.infos.type !== authType.LINK_SHARE &&
|
||||
this.$route.params.type !== 'gantt' &&
|
||||
this.$route.params.type !== 'table' &&
|
||||
this.$route.params.type !== 'list' &&
|
||||
this.$route.params.type !== ''
|
||||
) {
|
||||
router.push({name: 'showList', params: { id: this.$route.params.id }})
|
||||
|
|
|
@ -143,7 +143,6 @@
|
|||
},
|
||||
created() {
|
||||
this.taskService = new TaskService()
|
||||
this.initTasks(1)
|
||||
},
|
||||
methods: {
|
||||
// This function initializes the tasks page and loads the first page of tasks
|
||||
|
|
|
@ -19,6 +19,11 @@ export default {
|
|||
watch: {
|
||||
'$route.query': 'loadTasksForPage', // Only listen for query path changes
|
||||
},
|
||||
beforeMount() {
|
||||
// Triggering loading the tasks in beforeMount lets the component maintain the current page, therefore the page
|
||||
// is not lost after navigating back from a task detail page for example.
|
||||
this.loadTasksForPage(this.$route.query)
|
||||
},
|
||||
created() {
|
||||
this.taskCollectionService = new TaskCollectionService()
|
||||
},
|
||||
|
@ -67,7 +72,7 @@ export default {
|
|||
},
|
||||
loadTasksForPage(e) {
|
||||
// The page parameter can be undefined, in the case where the user loads a new list from the side bar menu
|
||||
let page = e.page
|
||||
let page = Number(e.page)
|
||||
if (typeof e.page === 'undefined') {
|
||||
page = 1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue