<script setup lang="ts"> import { ref, reactive } from 'vue'; const activeLink = ref(1); const menuList = reactive([ { id: 1, icon: 'bi bi-house-door', text: 'Home', }, { id: 2, icon: 'bi bi-person', text: 'Profile', }, { id: 3, icon: 'bi bi-chat', text: 'Mesaage', }, { id: 4, icon: 'bi bi-camera', text: 'Photos', }, { id: 5, icon: 'bi bi-gear', text: 'Settings', }, ]); function clickList(val: number) { activeLink.value = val; } </script> <template> <div class="content fit center"> <div class="navigation"> <ul> <li class="list" :class="{ active: item.id === activeLink }" @click="clickList(item.id)" v-for="item in menuList" :key="item.id" > <a href="javascript:volid(0);"> <span class="icon"><i :class="item.icon"></i></span> <span class="text">{{ item.text }}</span> </a> </li> <div class="indicator"></div> </ul> </div> </div> </template> <style lang="scss" scoped> * { margin: 0; padding: 0; box-sizing: border-box; } .content { background-color: #222327; } .navigation { width: 400px; height: 70px; background-color: #fff; position: relative; display: flex; justify-content: center; align-items: center; border-radius: 10px; ul { display: flex; width: 350px; li { position: relative; list-style: none; width: 70px; height: 70px; z-index: 1; a { position: relative; display: flex; justify-content: center; align-items: center; flex-direction: column; width: 100%; text-align: center; font-weight: 500; .icon { position: relative; display: block; line-height: 75px; font-size: 1.5em; text-align: center; transition: 0.5s; color: #222327; } .text { position: absolute; color: #222327; font-weight: 400; font-size: 0.75em; letter-spacing: 0.05em; opacity: 0; transform: translateY(20px); transition: 0.5s; } } &.active { a .icon { transform: translateY(-36px); } a .text { opacity: 1; transform: translateY(10px); } } } } } .indicator { position: absolute; top: -50%; width: 70px; height: 70px; border-radius: 50%; background-color: #29fd53; border: 6px solid #222327; transition: 0.5s; &::before { position: absolute; content: ''; top: 50%; left: -22px; width: 20px; height: 20px; border-top-right-radius: 20px; box-shadow: 0px -10px 0 0 #222327; background-color: transparent; } &::after { position: absolute; content: ''; top: 50%; right: -22px; width: 20px; height: 20px; border-top-left-radius: 20px; box-shadow: 0px -10px 0 0 #222327; background-color: transparent; } } .navigation ul li:nth-child(1).active ~ .indicator { transform: translateX(calc(70px * 0)); } .navigation ul li:nth-child(2).active ~ .indicator { transform: translateX(calc(70px * 1)); } .navigation ul li:nth-child(3).active ~ .indicator { transform: translateX(calc(70px * 2)); } .navigation ul li:nth-child(4).active ~ .indicator { transform: translateX(calc(70px * 3)); } .navigation ul li:nth-child(5).active ~ .indicator { transform: translateX(calc(70px * 4)); } </style>