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;
}