数组、对象中使用变量

实现效果

在这里插入图片描述

tab页签

<ul>
      <li *ngFor="let item of tabs; let i=index">
        <a (click)="handleClick(item.state,i)" [class.active]="categoryIndex === i">{{item.title}} · {{item.total}}</a>
      </li>
    </ul>
total1: number = 0
  total2: number = 0
tabs = [
    {
      title: '待办',
      state: 2,
      total: this.total1
    }, {
      title: '已办',
      state: 5,
      total: this.total2
    }
  ]
  //获取待办任务
  getRunningData(state, owner) {
    this.loading = true
    this.service.getRunningTask(state, owner).subscribe((res: any) => {
      this.loading = false
      this.data = res.content     
      this.i18n.setLocale(zh_CN);   
      console.log('this.data', this.data)
      if(state===2){        
        this.total1 =  res.content.length
        //this.total1发生变化时必须再给数组重新赋值,要不total1一直是初始值0
        this.tabs[0].total = this.total1
      }else if(state===5){
        this.total2 =  res.content.length
        this.tabs[1].total = this.total1
      } 
      console.log('this.tabs',this.tabs)
      
      this.cd.markForCheck()     
    })
  }

打开任务中心界面

<div class="more" (click)="viewTaskCenter()">
/**
   * 更多,打开任务中心
   */
   viewTaskCenter() {
    const options: any = {
      appType: 'menu',
      funcId: 'WF0101',
      appId: '',
      appEntrance: '',
      tabId: 'WF0101',
    };
    (window as any).gspframeworkService.rtf.func.openMenu(options);
  }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值