微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Vue slick carousel 动态滑块 asNavFor 问题

如何解决Vue slick carousel 动态滑块 asNavFor 问题

<b-tabs class="learning-center-tab px-0">
            <b-tab :active="CategoryHash==Category.vSlug || (CategoryHash='' && index=='0')" v-for="(Category,index) in Categories" :set="cref = 'c'+(index+1)+'2'">
                <template #title>
                    <span @mouSEOver="hoverFunc" @mouseleave="unhoverFunc"> {{ Category.vTitle }}{{ index }} </span>
                </template>
                <b-row align-h="end" class="sub_cat_select_Box" :style="{ bottom: lcTabBoxBottom }" v-if="Category.sub_category.length>0">
                    <b-form-select v-model="selected">
                        <option value="null">Pet Type</option>
                        <option v-for="(selectOption,indexOpt) in Category.sub_category" :key="indexOpt" :value="selectOption.iCategoryId">
                            {{ selectOption.vTitle }}
                        </option>
                    </b-form-select>
                </b-row>
                <div @wheel.prevent="wheelItBetter($event,cref)">
                    <VueSlickCarousel class="LC-slider" v-bind="BannerImage" @reInit="onInitCarousel" :asNavFor="$refs.cref">
                        <div class="slick-slider-item">
                            <div class="slid-img-Box" :style="{backgroundImage: 'url(' + Category.vImagePath + ')'}"></div>
                            <div class="lc-caption" :style="{ width: captionWidth }">
                                <h2>DigyPet Learning Center</h2>
                                <h5>Resources and tips to help you be the best <br /> pet parent you can be.</h5>
                            </div>
                        </div>
                    </VueSlickCarousel>
                    <VueSlickCarousel class="LC-slider-nav-thumbnails" v-bind="IconImage" :ref="cref">
                        <div class="pl-4" v-for="(LearningCenter,index1) in Category.learning_center">
                            <b-img :src="LearningCenter.vImagePath" rounded fluid alt="Responsive image"></b-img>
                            <p @mouSEOver="hoverFunc" @mouseleave="unhoverFunc">
                                <NuxtLink :to="'/learning-center/'+LearningCenter.vSlug">
                                    {{ LearningCenter.vTitle }}
                                </NuxtLink>
                            </p>
                        </div>
                    </VueSlickCarousel>
                </div>
            </b-tab>

这是我的轮播代码,下面是wheelItBetter函数

wheelItBetter(event,ref) {
        console.log(ref);
        if (event.deltaY < 0) {
            this.$refs[ref].prev();
        } else {
            this.$refs[ref].next();
        }
    }

显示以下错误的鼠标滚轮事件::

TypeError: this.$refs[ref].next is not a function
at VueComponent.wheelItBetter (index.vue?93c2:306)
at wheel (index.vue?055e:199)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at HTMLdivelement.invoker (vue.runtime.esm.js?2b0e:2179)
at HTMLdivelement.original._wrapper (vue.runtime.esm.js?2b0e:6917)

提出一些建议。我尝试了各种方法解决这个问题。但找不到任何解决方案。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。