绿满眶商城微信小程序-uniapp
peng
2025-06-27 7673b8272cfd9fc21161b70e35c263e455b59966
components/TopBar.vue
@@ -1,5 +1,5 @@
<template>
   <view class="top-bar" :style="{paddingTop: statusBarHeight + 'px'}">
   <view class="top-bar" :style="{paddingTop: statusBarHeight + 'rpx'}">
      <view class="top-bar-content">
         <!-- 标题列表 -->
         <scroll-view class="title-scroll" scroll-x="true" scroll-with-animation :scroll-left="scrollLeft">
@@ -8,10 +8,11 @@
                  v-for="(item, index) in titleList" 
                  :key="index"
                  :class="{active: selectedTitleIndex === item.index, 'title-item': true}"
                  :style="{color: textColor}"
                  @click="changeTab(item)"
               >
                  <text>{{item.title}}</text>
                  <view class="underline" v-if="selectedTitleIndex === item.index"></view>
                  <view class="underline" :style="{backgroundColor: textColor}" v-if="selectedTitleIndex === item.index"></view>
               </view>
            </view>
         </scroll-view>
@@ -26,6 +27,10 @@
         selectedTitleIndex: {
            type: String,
            default: 'home'
         },
         textColor: {
            type: String,
            default: 'white'
         }
      },
      data() {
@@ -117,7 +122,7 @@
         position: relative;
         padding: 0 24rpx;
         font-size: 32rpx;
         color: white;
         /* color: white; */
         height: 100%;
         display: flex;
         align-items: center;
@@ -136,7 +141,7 @@
         transform: translateX(-50%);
         width: calc(100% - 76rpx);
         height: 4rpx;
         background-color: white;
         /* background-color: white; */
         border-radius: 4rpx;
      }
</style>