Yuki Hashimoto
Yuki Hashimoto

Reputation: 1073

How to scroll down to the bottom of page with vuetify

I want to implement an application composed of several card views and a succeeding button. On each click of the button, the page should be scrolled to its bottom.

I found some Q&As which implement the scrolling by native javascript, but I did not get how to implement it on Vuetify framework. I looked at the documentation (https://vuetifyjs.com/en/directives/scrolling) and noticed that the scrolling is to be implemented via $vuetify.goTo.

But I did not find the exact way to specify the bottom of the page on Vuetify-like style.

Is there any good idea to implement it with good Vuetify maner?

Upvotes: 2

Views: 6635

Answers (1)

Roland
Roland

Reputation: 27819

You can have a computed property returning the height of the page:

computed: {
    pageHeight () {
      return document.body.scrollHeight
    }
}

And then use vuetify for scrolling to the bottom like:

$vuetify.goTo(pageHeight)

Upvotes: 4

Related Questions