When the page is rolled back, the page number of the page is changed to 1.

my list page has a list. Notice that the page here is 5. Clicking on this name will jump to the details page: detail page, but when I return list from the detail page, the page will return to 1. What do I have to do to get back to the back page or 5?

my fallback is: this.$router.go (- 1);

< hr >

Edit 01

Jump from the list page to the details page:

go_details(h, params){
    let query = {
      id: params.row.id
    }
    this.$router.push({
      name: "physicalserverDetails",
      query: query
    });
  },
Apr.15,2021

you must have used replace to switch to Push.

if you take a closer look, this happens only when you jump back to the details page. Which problem is that when you jump in pages, you jump through router? if not, consider keep-alive

.

consider using Vue's cache, to learn about .
after the current page has been cached, going back to this page will show the status of the last departure, that is, it will give you the effect you want. Give it a try.


: page url $route loadList url page loadList

export default {

    data () {
        return {
            page: 1
        }
    },
    
    created () {
        this.onRoute()
    },
    
    watch: {
        '$route': 'onRoute'
    },
    
    onRoute () {
        this.loadList()
    },
    
    pushRouter () {
        // 
        var query = this.$route.query
        var queryString = ''
        for (let key in query) {
            if (key !== 'page') queryString += `&${key}=${query[key]}`
        }
        this.$router.replace(`/ url?${queryString}&page=${this.page}`)
    },
    
    /**
    * 
    */
    loadList () {
        this.$request({
            url: ' url',
            params: {
                page: this.page
            }
        }).then((data) => {
            console.log(data)
        })
    },
    
    /**
    * 
    */
    clickPaginator (page) {
        this.page = page
        this.pushRouter()
    }
}
Menu