element根据不同的tab页签进行检索

每次搜索的时候只搜索激活状态的那个接口,当用户切换的时候在调用另一个。

data() {
    activeName: '1'
},
methods: {
    //点击tab页签将name值赋给当前状态
    handleClick(val) {
      this.activeName = val.name
    }, 
    //搜索时候根据activeName来判断,分别调用各自tab页签的接口
    handleQuery() {
      if (this.activeName === '1') {
        this.getWeightExList();
      }
      else if (this.activeName === '2') {
        this.getCompanyWeightExList();
      }
      else {
        this.getBusinProportion();
       }
    }
  }
原文地址:https://www.cnblogs.com/theblogs/p/13726600.html