How to achieve the height of the Vue page window at the specified height?

how to achieve the window height of the Vue page at the specified height?

if I want to enter the page now, how can the height of the page be realized in the position of 300px?

because every time I click to see the details, I want to save the height of the current page, and then when I return to the list, I go directly to this height,

console.log(document.documentElement.scrollTop || document.body.scrollTop)//

in this way, I know where the page is, and when I want to return it now, it is directly in this location (the value I have saved in localStorage)

Aug.13,2021

try this

window.scrollTo (x, y)


mounted () {
    window.scrollTo(0, 300);
}

take it out in mounted and scroll to that position

Menu