fh-components icon indicating copy to clipboard operation
fh-components copied to clipboard

Allow custom pager template slots for slide-show

Open drewbaker opened this issue 6 years ago • 4 comments

It would be great if this worked:

    <div class="pager">
        <button class="pager-item" slot="pagination-item" slot-scope="args" :aria-label="args.slide.title"/>
    </div>

drewbaker avatar Sep 09 '18 03:09 drewbaker

@drewbaker Just want to make sure I understand - how would this differ from the current pagination-item slot? (link) Thanks!

SaFrMo avatar Oct 24 '18 18:10 SaFrMo

From memory, I don't think you can put the pagination-item in it's own DIV like that. But it's been awhile since I opened this, I can't fully remember.

drewbaker avatar Oct 24 '18 18:10 drewbaker

Yeah so I'm dealing with this today. You can't put wrappers around slot-scope items.

    <slide-show
        class="shortcode-gallery-slideshow"
        :slides="images"
    >
        <div class="slides">
            <responsive-image
                class="slide"
                slot="slide"
                slot-scope="{ slide, index }"
                :object="slide"
                size="fullscreen"
            />
        </div>
        <div class="nav-items">
            <div class="nav prev" slot="nav-prev"/>
            <div class="nav next" slot="nav-next"/>
        </div>
    </slide-show>

In the above example, the slides will be outside slides and the nav buttons will be outside of nav-items.

drewbaker avatar Dec 06 '18 21:12 drewbaker

Looking into this now, I don't actually think it's possible to do what you want unfortunately @drewbaker.

The slots are just being used to identify what a single one of those elements should look like, i.e. what a single pagination item should look like or a single slide should look like. The component itself wraps those items in its own markup and v-for statements and whatnot so the logic all works correctly, so being able to wrap them in your own markup would conflict.

I wish Vue had a good way to deal with this sort of tightly coupled logic between parent and child components but it doesn't. Any other ideas you can think of @SaFrMo ?

johndigital avatar Dec 10 '18 20:12 johndigital