复制官网demo
<div class="block text-center" m="t-4" >
<el-carousel trigger="click" height="150px" :autoplay=false ref="myRef">
<el-carousel-item v-for="item in 3" :key="item" >
<h3 class="small justify-center" text="2xl">
<router-view></router-view>
</h3>
</el-carousel-item>
</el-carousel>
</div>
编写JS逻辑 : 轮播图根据changeIndexTo传入的value决定内容
<script setup>
import {ref} from "vue"
const myRef = ref(null)
const changeIndexTo = (value)=>{
console.log( myRef.value)
myRef.value.setActiveItem(value)
}
</script>