-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to show the bar when I initialize it #24
Comments
Same issue here |
If you're loading your content of the scroll container with an ajax call, you'll need to have the scroll component wait for the response. Otherwise, it initializes with a zero height container, which makes the scrollbar itself hide. |
@zaclem01 maybe any resize/re-render event on data changing? Otherwise it is some useles, because vue js is a modern framework for app with dynamic data, and most of this data can be loaded via ajax) |
I added a reference to the vue2-scrollbar component, then after the async data has been fetched, I call the calculateSize() method from the scrollbar reference; works like a charm.
Hope it helps |
You can simply add updated ()
{
this.calculateSize()
}, after the |
My solution export default {
components: {
'vue-scrollbar': require('vue2-scrollbar')
},
data() {
return {
onceCalculateSizeScroll: true
};
},
updated() {
if (this.onceCalculateSizeScroll) {
this.$refs.scrollbar.calculateSize();
this.onceCalculateSizeScroll = false;
}
},
} |
Hi
In you demo, the scrollbar is always showing. But in my project, The scrollbar only display when I scrolling, I want it to be displayed when the component was initialized for the first time. What should I do?
Thank you!
The text was updated successfully, but these errors were encountered: