前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >怎样切换tab显示不同的数据

怎样切换tab显示不同的数据

作者头像
不爱吃糖的程序媛
发布2024-01-18 20:32:06
840
发布2024-01-18 20:32:06
举报
1.需求

点击不同的tab选项卡,会切换到不同的内容项目

在这里插入图片描述
在这里插入图片描述
2.实现

在成功调用接口后,数据展示如图所示

在这里插入图片描述
在这里插入图片描述
3.代码

以下为主要代码的逻辑 解读this.query.auditType = 4;意思就是访问后台的数据的状态类型为4(根据接口文档给出的),用Switch条件读出来。

代码语言:javascript
复制
// 访问后台的数据
 query: {
    current: 1,
    auditType: "",
  },
  // 后台返回的数据
  dataList: {
    rows: [{}],
  },
  current: 0,
  
//查询当前登录用户需要审核的工单列表 
  getOrderAuditList() {
    serve.getAuditList(this.query).then((res) => {
      uni.stopPullDownRefresh();
      this.dataList = res;
    })
  },
  //切换tab
    change(index) {
      this.current = index;
      this.query.current = 1;
      switch (index) {
        case 0:
          this.query.auditType = "";
          break;
        case 1:
          this.query.auditType = 6;
          break;
        case 2:
          this.query.auditType = 5;
          break;
        case 3:
          this.query.auditType = 1;
          break;
        case 4:
          this.query.auditType = 4;
          break;
        case 5:
          this.query.auditType = 2;
          break;
        case 6:
          this.query.auditType = 3;
          break;
        default:
          console.log("err");
      }
      this.getOrderAuditList();
    },
本文参与?腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2024-01-18,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客?前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与?腾讯云自媒体分享计划? ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.需求
  • 2.实现
  • 3.代码
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
http://www.vxiaotou.com