antd轮播图goTo的用法

由于官方文档写的非常少,生怕你看懂了,经过各种百度搜索,终于找到了具体用法,记录下来

<a-carousel arrows ref="varousel" :dots="true">
            <div
                slot="prevArrow"
                class="custom-slick-arrow"
                style="left: 10px;zIndex: 1;"
            >
                <img src="~@/content/images/left_arrow.png" alt />
            </div>
            <div
                slot="nextArrow"
                slot-scope="props"
                class="custom-slick-arrow"
                style="right: 10px;zIndex: 1;"
            >
                <img src="~@/content/images/right_arrow.png" alt />
            </div>
            <div>
                <img src="~@/content/images/event.jpg" style="width: 100%;height: 560px;" />
            </div>
            <div>
                <img src="~@/content/images/bg.jpg" style="width: 100%;height: 560px;" />
            </div>
            <div>
                <img src="~@/content/images/modal_head_bg.png" style="width: 100%;height: 560px;" />
            </div>
        </a-carousel>
        <div class="imgGroup">
            <img src="~@/content/images/event.jpg" alt="1" @click="goTo(1, false)" :class="{ select: currentIndex==1 }"/>
            <img src="~@/content/images/bg.jpg" alt="2" @click="goTo(2, false)" :class="{ select: currentIndex==2 }"/>
            <img src="~@/content/images/modal_head_bg.png" alt="3" @click="goTo(3, false)" :class="{ select: currentIndex==3 }"/>
        </div>
    </a-modal>
</template>
    goTo(index: any) {
        this.currentIndex = index;
        (this.$refs["varousel"] as any).goTo(index - 1);
    }
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值