Skip to content
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

Container prop for scroll-container #2

Open
VictorGa opened this issue Nov 21, 2017 · 2 comments
Open

Container prop for scroll-container #2

VictorGa opened this issue Nov 21, 2017 · 2 comments

Comments

@VictorGa
Copy link

Hello!

I've been trying to pass a different container to the scroll-container with no luck. Looking at the code, it seems that the container (dom element) needs to be when creating the scroll-container.

My scroll-container is inside of a component, and the container I want to pass as props is the $el of that component itself.

Is it possible to pass a new container once the scroll-container is created? Or halt the creation untill the new container is accessible?

Thanks for the work!!

@AlexandreBonaventure
Copy link
Owner

It's currently impossible but I'll def try to bring a solution to your usecase.

@vdcrea
Copy link

vdcrea commented Aug 6, 2018

I had the same issue, as a workaround you can wrap the scrolling component in a parent's div, and pass its node via data:

parent.vue

<template>
  <div id="container">
    <Child />
  </div>
</template>

<script>
import Child from './child'
export default {
  components: {
    child
  }
}
</script>

child.vue

<template>
  <ScrollContainer :container="container">
    <ScrollItem />
  </ScrollContainer>
</template>

<script>
export default {
  data () {
    container: document.getElementById('container')
  }
}
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants