Replies: 2 comments 1 reply
-
Hi @1001v, Thanks for suggesting improvements. Much appreciated.
This can be done without breaking changes because the export is a default export. However, if you or someone else wanting to contribute create a PR for this, I would appreciate if that person search the code for
Could you share an example to illustrate his?
This depends on the decision we make on point 2. If we decide to keep the current way of doing it, we can leave the array because the first thing you'll always need will be the |
Beta Was this translation helpful? Give feedback.
-
@davidjerleke Hello! Thanks for the answer.
Yes, but IDE would still suggest to import
Well, let me try: import emblaCarouselVue from 'embla-carousel-vue'
// Own composible
// Let's assume we get the ref as an argument
export function useEmbla(wrapper: Ref<HTMLElement>) {
// Or we might want to inject it from somewhere
// const wrapper = inject('wrapper')
// We call embla
const [emblaRef] = emblaCarouselVue()
// Now we need to link refs something like that
watch(wrapper, (value) => {
if (value) {
emblaRef.value = value
}
})
// Some other code
// Some return
} So, my point is, that the watch part in our own wrapper can be removed completely if
I believe that depends on how we see the purpose of the official integration. Should it produce only minimal functionality or should it be a full-featured solution? If it's the second case, then I suppose the composable could return some vue entities which would represent emblaApi's state or even control it. // index: Ref<number>
// canScrollNext/canScrollPrev: ComputedRef<boolean>
const { index, canScrollNext, canScrollPrev } = useEmblaCarousel(wrapperRef) So the short answer is, that return value should be the object, if farther vuefication of composable is in order. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Which variants of Embla Carousel are relevant to this feature request?
Feature description
Hello. I would like to suggest some improvements for embla-carousel-vue package. I understand, that most of these are breaking, but I believe some of them can be introduced in a future major version.
Example:
Thanks.
Additional Context
Additional details here...
Before submitting
Beta Was this translation helpful? Give feedback.
All reactions