<template>
<div class="nav-bottom">
<span class="prev">
<i class="el-icon-arrow-left" @click="prenHandle"></i>
</span>
<div class="content">
<ul :style="{ transform: 'translateX(' + left + 'px)' }">
<li v-for="(item, index) in 20" :key="index">
<p>{
{ item }}</p>
</li>
</ul>
</div>
<span class="next">
<i class="el-icon-arrow-right" @click="nextHandle"></i>
</span>
</div>
</template>
<script>
export default {
data() {
return {
width: 0,
left: 0,
index: 1
};
},
watch: {},
methods: {
prenHandle() {
if (this.index == 0) return;
this.index++;
this.left = this.index * 134;
},
nextHandle() {
if (this.index == -15) return;
this.index--;
this.left = this.index * 134;
}
},
mounted() {
this.width = this.width * 20;
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.nav-bottom {
width: 750px;
height: 110px;
display: flex;
justify-content: space-around;
position: relative;
text-align: center;
background: rgba(2, 27, 52, 0.7);
border-radius: 10px;
.content {
width: 660px;
height: 70px;
margin-top: 20px;
overflow: hidden;
ul {
display: flex;
width: 320px;
height: 70px;
li {
width: 124px;
height: 70px;
line-height: 70px;
display: flex;
margin-right: 10px;
flex-direction: column;
flex-shrink: 0;
text-align: center;
color: #fff;
background: #090;
}
}
}
span {
width: 45px;
height: 110px;
line-height: 110px;
font-size: 28px;
color: #0293d9;
i {
cursor: pointer;
}
}
.prev {
float: left;
}
.next {
float: right;
}
}
</style>