vue3.x + elementPlus之el-carousel setActiveItem方法使用
vue3.x + elementPlus之el-carousel setActiveItem方法使用
·
html
<el-carousel ref="remarkCaruselUp" :interval="5000" arrow="always">
<el-carousel-item
v-for="(item, i) in uploadDataAll.dialogImageUrlList"
:key="i"
:name="'i' + i"
:autoplay="false"
>
<img class="up-d-img" :src="item.url" alt="" />
</el-carousel-item>
</el-carousel>
js
const remarkCaruselUp = ref(null)
setup() {
// 点击查看图片
const handlePictureCardPreview = (i) => {
//查看对应name的图片
nextTick(() => {
remarkCaruselUp.value.setActiveItem('i' + i)
})
}
return { remarkCaruselUp }
}
更多推荐
已为社区贡献4条内容
所有评论(0)