6、轮播图前端改造
xadmin可视化上传图片
# 1.管理员登入录入数据
Banner.vue组件改造
<!-- 修改Banner.vue组件 -->
<template>
<el-carousel height="520px" :interval="3000" arrow="always">
<el-carousel-item v-for="item in banner_list">
<a :href="item.link">
<img :src="item.image" alt="">
</a>
</el-carousel-item>
</el-carousel>
</template>
<script>
export default {
name: "Banner",
data: function () {
return {
banner_list: []
}
},
created: function () {
let _this = this;
this.$axios({
url: this.$settings.Host + '/home/banner/',
}).then(function (response) {
_this.banner_list = response.data;
}).catch(function (error) {
console.log(error)
})
}
}
</script>
<style scoped>
.el-carousel__item h3 {
color: #475669;
font-size: 18px;
opacity: 0.75;
line-height: 300px;
margin: 0;
}
.el-carousel__item:nth-child(2n) {
background-color: #99a9bf;
}
.el-carousel__item:nth-child(2n+1) {
background-color: #d3dce6;
}
img {
text-align: center;
height: 520px;
}
</style>
程序猿,要对自己狠一点!