vue中使用el-carousel组件实现图片轮播效果
代码实现:<!--home--><template><div><el-carousel trigger="click" height="250px" :interval="3000" arrow="always" style="width:800px"><el-carousel-item v-for="item in imgList" :key
·
图片地址:
代码实现:
<!--home-->
<template>
<div>
<el-carousel trigger="click" height="250px" :interval="3000" arrow="always" style="width:800px">
<el-carousel-item v-for="item in imgList" :key="item.name">
<img :src="item.src" style="height:100%;width:100%;" alt="图片丢失了" :title="item.title" />
</el-carousel-item>
</el-carousel>
</div>
</template>
<script>
export default {
components: {},
data() {
return {
imgList: [
{
name: "lj",
src: require("@/assets/lj.png"),
title: "这是lj.png"
},
{
name: "logo",
src: require("@/assets/logo.png"),
title: "这是logo.png"
},
{
name: "bg",
src: require("@/assets/bg.png"),
title: "这是bg.png"
},
{
name: "sadmas",
src: require("@/assets/sadmas.png"),
title: "这是sadmas.png"
}
]
};
},
created() {},
mounted() {},
computed: {},
methods: {}
};
</script>
<style lang="scss">
</style>
效果图:
更多推荐
已为社区贡献65条内容
所有评论(0)