uni-app tab切换

<!-- 离线二次告警 -->
<template>
  <view class="salarm-offLine">
    <scroll-view class="salarm-offLine-title" scroll-x="true">
      <view
        v-for="(item, index) in titleData"
        :key="index"
        @tap="checkIndex(index)"
        :class="[
          navIndex == index ? 'salarm-offLine-title-active' : '',
          'salarm-offLine-item_H',
        ]"
        >{{ item }}</view
      >
    </scroll-view>
    <onceReport v-if="navIndex == 0"/>
    <exceedReport v-else-if="navIndex == 1"/>
    <powerReport v-else-if="navIndex == 2"/>
    <equipmentReport v-else-if="navIndex == 3"/>
  </view>
</template>

<script>
import powerReport from "../../components/report/powerReport/powerReport.vue";
import exceedReport from "../../components/report/exceedReport/exceedReport.vue";
import onceReport from "../../components/report/onceReport/onceReport.vue";
import equipmentReport from "../../components/report/equipmentReport/equipmentReport.vue";
export default {
  data() {
    return {
      titleData: ["离线一次告警", "超标告警", "电源告警", "设备清洗告警"],
      navIndex: 0,
    };
  },
  components: {
    powerReport,
    exceedReport,
    onceReport,
    equipmentReport,
  },
  methods: {
    checkIndex(index) {
      let _this = this;
      _this.navIndex = index;
      console.log(index);
    },
    //跳转详情页面
    handelSalarmList() {
      uni.navigateTo({
        url: "/components/report/salarmOffLineParticulars/salarmOffLineParticulars",
      });
    },
  },
};
</script>

<style lang="scss">
.salarm-offLine {
  height: 100%;
  .salarm-offLine-title {
    width: 100%;
    height: 40px;
    background-color: rgba(255, 255, 255, 1);
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
    .salarm-offLine-item_H {
      color: #888888;
      font-size: 26rpx;
      display: inline-block;
      margin: 0 3%;
      line-height: 78rpx;
      font-family: PingFang-SC-Regular;
      height: 80rpx;
    }
    .salarm-offLine-title-active {
      font-weight: bold;
      color: #3f87ff;
      position: relative;
      &::after {
        content: "";
        width: 80%;
        height: 3px;
        background: #3f87ff;
        position: absolute;
        bottom: 10%;
        left: 10%;
        border-radius: 10px;
      }
    }
  }
}
</style>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值