手写切换tab

在这里插入图片描述
HTML:

<a-Row> 
  <a-col :span="6"  class="leftContentTabs" v-for="(i, index) in searchForm.leftContentTabsList" :key="index" @click="changeTabs(i)">
    <div class="leftContentTabsText" :class="`${i.tabsBaseText}_${mobileType === i.code?'2':'1'}`">{{i.name}}</div>
  </a-col>
</a-Row>

Js:

setup(props: any, context: any) {
        let searchForm: any = reactive({
            leftContentTabsList: [{
                tabsBaseText: "tabsText1",
                code: "1",
                name:"航空巡测"
            }, {
                tabsBaseText: "tabsText2",
                code: "2",
                name:"陆地巡测"
            }, {
                tabsBaseText: "tabsText3",
                code: "3",
                name:"海上巡测"
            }, {
                tabsBaseText: "tabsText4",
                code: "4",
                name:"投放式测量"
            }],
        })
        //切换tab
        let mobileType = ref("1")
        //取样
        const changeTabs = (record: any) => {  
            mobileType.value = record.code
            console.log("当前选中code:", record.code)
            nextTick(() => {
                getMobileMeasurandPage()
            })
        }
        //列表接口
        let tableLoading1 = ref(false)
        const getMobileMeasurandPage = async (e?: any) => {
            let res = await request1.getMobileMeasurandPage({ current: searchForm.current1, size: searchForm.size1 }, [mobileType.value ? mobileType.value : "1"], searchForm.nuclearPowerPlantCode);
            if (res.code === 200) {
                searchForm.tableDataMobile = res.data.records

            }
        }
        return {
            mobileType,//移动式测量切换tab
            changeTabs,
        }
}

CSS:

.leftContentTabs{
    height: 40px;
    width: 100px;
    margin-bottom: 10px;
    border-bottom: 4px solid #3894FF;
    display: flex;
    align-items: center;
    justify-content: center;
        >div{
            width: 100px;
            height: 40px;
        }
    .leftContentTabsText{
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
.tabsText1_1{
    // background-image: url("../../../../assets/images/quanguo.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    background-color: #ffffff;
    color: #000000;
}
.tabsText1_2{
    // background-image: url("../../../../assets/images/quanguoCheck.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    
    background-color: #3894FF;
    color: #ffffff;
}
.tabsText2_1{
    // background-image: url("../../../../assets/images/guangdong.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    
    background-color: #ffffff;
    color: #000000;
}
.tabsText2_2{
    // background-image: url("../../../../assets/images/guangdongCheck.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    
    background-color: #3894FF;
    color: #ffffff;
}
.tabsText3_1{
    // background-image: url("../../../../assets/images/zhejiang.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    
    background-color: #ffffff;
    color: #000000;
}
.tabsText3_2{
    // background-image: url("../../../../assets/images/zhejiangCheck.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    
    background-color: #3894FF;
    color: #ffffff;
}
.tabsText4_1{
    // background-image: url("../../../../assets/images/zhejiang.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    
    background-color: #ffffff;
    color: #000000;
}
.tabsText4_2{
    // background-image: url("../../../../assets/images/zhejiangCheck.png");
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    background-color: #3894FF;
    color: #ffffff;
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值