<template>
<div class="docker">
<div v-for="(item, index) in dockerList"
:class="[info.num === index ? 'docker__item docker__item--active' : 'docker__item']" :key="item.icon"
@click="() => changeColor(index)">
<router-link :to='item.to'>
<div class="iconfont" v-html="item.icon" />
<div class="docker__title">{{ item.text }}</div>
</router-link>
</div>
</div>
</template>
<script>
import { reactive } from "vue";
export default {
name: 'Docker',
setup() {
const dockerList = [
{ icon: '', text: '首页', to: { name: 'Home' } },
{ icon: '', text: '购物车', to: { name: 'CartList' } },
{ icon: '', text: '订单', to: { name: 'Home' } },
{ icon: '', text: '我的', to: { name: 'Home' } },
];
let info = reactive({ num: 0 })
const changeColor = index => info.num = index;
return { dockerList, changeColor, info }
}
}
</script>
<style scoped>
@import '../../style/viriables.scss';
.docker {
display: flex;
box-sizing: border-box;
position: absolute;
padding: 0 .18rem;
left: 0;
bottom: 0;
width: 100%;
height: .49rem;
border-top: .01rem solid $content-bgColor;
&__item {
flex: 1;
text-align: center;
a {
color: $content-fontcolor;
text-decoration: none;
}
.iconfont {
margin: .07rem 0 .02rem 0;
font-size: .18rem;
}
&--active {
a {
color: #1FA4FC;
}
}
}
&__title {
font-size: .2rem;
transform: scale(.5, .5);
transform-origin: center top;
}
}
</style>

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星