直接上代码,
<template>
<div class="block">
<span class="demonstration"></span>
<el-carousel height="150px">
<el-carousel-item v-for="item in 4" :key="item">
<img height="150px" v-bind:src="require('../assets/lunbo/' + imgs[item-1])">
<h3 class="small">{{ item }}</h3>
</el-carousel-item>
</el-carousel>
</div>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data(){
return{
imgs:["hua1.jpg", "hua2.jpg", "timg.jpeg", "sunyang.jpg"],
}
}
}
</script>