优化代码

This commit is contained in:
wangxiaowei 2024-08-09 15:08:20 +08:00
parent 846939817a
commit f68fbe2e2a

@ -12,8 +12,8 @@
<view class="scroll-box" :class="{'tabs-scorll-flex': !isScroll}"> <view class="scroll-box" :class="{'tabs-scorll-flex': !isScroll}">
<view class="tab-item line1" :id="'tab-item-' + index" v-for="(item, index) in list" <view class="tab-item line1" :id="'tab-item-' + index" v-for="(item, index) in list"
:key="index" @tap="clickTab(index)" :style="[tabItemStyle(index)]"> :key="index" @tap="clickTab(index)" :style="[tabItemStyle(index)]">
<u-badge :count="item[count] || item['dot'] || 0" :offset="offset" size="mini"></u-badge> <u-badge :count="item[count] || item['dot'] || 0" :offset="offset" size="mini" class="badge"></u-badge>
{{ item[name] || item['name']}} {{ item[name] || item['name']}}
</view> </view>
<view v-if="showBar" class="tab-bar" :style="[tabBarStyle]"></view> <view v-if="showBar" class="tab-bar" :style="[tabBarStyle]"></view>
</view> </view>
@ -376,4 +376,11 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.badge {
position: absolute;
top: 8rpx;
left: 80%;
transform: translateX(-80%);
}
</style> </style>