2023.11.7

This commit is contained in:
2023-11-07 00:12:02 +08:00
parent e0a0f1ac1e
commit b1e3735af0
11 changed files with 455 additions and 31 deletions

View File

@@ -8,6 +8,7 @@
:class="{current: index === tabCurrentIndex}" :id="'tab'+index" @click="changeTab(index)">{{item.name}}
</view> -->
<view v-for="(item,index) in tabArr" :key="item.id" class="nav-item"
:style="{width:tab_width+'%'}"
:class="{current: index === o_index}" :id="'tab'+index" @click="changeTab(index)">{{item.name}}
</view>
</scroll-view>
@@ -22,16 +23,18 @@
scrollTimer = false,
tabBar;
export default {
data() {
return {
tabCurrentIndex: 0, //当前选项卡索引
scrollLeft: 0, //顶部选项卡左滑距离
tab_width:0,
}
},
mounted() {
console.log(this.tabArr)
this.tab_width = parseFloat(100/this.tabArr.length)
},
props: {
tabArr: {
type: Array,
default () {
@@ -47,7 +50,6 @@
},
methods: {
//tab切换
async changeTab(e) {
@@ -160,14 +162,15 @@
.nav-item {
display: inline-block;
/* width: 150upx; */
width: 50%;
/* width: 33.33%; */
height: 90upx;
text-align: center;
line-height: 90upx;
font-size: 30upx;
color: #303133;
/* color: #303133; */
color: gray;
position: relative;
font-weight: 900;
&:after {
content: '';
width: 0;