vue 绑定background 属性的写法
参考链接 :https://blog.csdn.net/qq_34664239/article/details/79106570元素<template><el-carousel trigger="click" height="386px" :autoplay=false arrow="never"><el-carouse...
·
参考链接 :https://blog.csdn.net/qq_34664239/article/details/79106570
元素
<template>
<el-carousel trigger="click" height="386px" :autoplay=false arrow="never">
<el-carousel-item v-for="(item,index) in options" :key="index" :style="{backgroundImage:'url(' + item.img + ')', backgroundRepeat:'no-repeat', backgroundPosition:'center top', backgroundSize: 'cover'}">
<div class="info">
<h2>{{item.info}}</h2>
</div>
</el-carousel-item>
</el-carousel>
</template>
数据
<script>
export default {
data(){
return {
options:[{
// 图片的引入方式
img:require('../assets/images/banner.jpg'),
info:'Access Institutional tools direct from MT4 when you go live'
},{
img:require('../assets/images/banner.jpg'),
info:'Access Institutional tools direct from MT4 when you go live'
},{
img:require('../assets/images/banner.jpg'),
info:'Access Institutional tools direct from MT4 when you go live'
},{
img:require('../assets/images/banner.jpg'),
info:'Access Institutional tools direct from MT4 when you go live'
}]
}
}
}
</script>
更多推荐
已为社区贡献8条内容
所有评论(0)