| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <section class="mb-tabs-container">
- <section class="mb-tabs">
- <div v-for="(tab, index) in productTabs" :key="index" class="tab-item" :class="{ active: activeTab === index }"
- @click="activeTab = index">
- {{ tab.name }}
- </div>
- <!-- <van-tabs v-model:active="activeTab">
- <van-tab v-for="(tab, index) in productTabs" :title="tab.name">
- </van-tab>
- </van-tabs> -->
- </section>
- </section>
- </template>
- <script setup>
- import { productTabs } from '~/utils/product';
- const activeTab = ref(0)
- const currentTabData = computed(() => tabs[activeTab.value])
- </script>
- <style lang="scss" scoped>
- .mb-tabs-container {
- position: absolute;
- width: 100%;
- left: 0;
- top: 58%;
- transform: translateY(-50%);
- z-index: 2;
- }
- .mb-tabs {
- width: 100%;
- box-sizing: border-box;
- height: 42px;
- margin: 0 auto;
- border-radius: 150px;
- background: linear-gradient(177deg, rgba(165, 101, 255, 0.30) -20.47%, rgba(3, 0, 20, 0.30) 134.25%);
- backdrop-filter: blur(20px);
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 0 12px;
- overflow-x: auto;
- scroll-behavior: smooth;
- -webkit-overflow-scrolling: touch;
- /* 隐藏滚动条 */
- scrollbar-width: none;
- -ms-overflow-style: none;
- &::-webkit-scrollbar {
- display: none;
- }
- .tab-item {
- flex-shrink: 0;
- font-size: 14px;
- font-weight: 400;
- line-height: 1;
- color: #ffffff;
- cursor: pointer;
- white-space: nowrap;
- transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease;
- display: flex;
- align-items: center;
- justify-content: center;
- min-width: 88px;
- height: 32px;
- padding: 0 16px;
- border-radius: 16px;
- background: transparent;
- &.active {
- background: linear-gradient(62.84deg, rgba(130, 77, 255, 1) 0%, rgba(164, 125, 255, 1) 100%);
- color: #ffffff;
- font-weight: 500;
- }
- &:hover:not(.active) {
- color: #bdbdbd;
- transform: translateY(-1px);
- }
- }
- }
- </style>
|