vue中子组件判断父组件中tab是否打开过(二)

1.父组件中的方法】

isopened(comp){
  var j=0;
  for(var i = 0; i <this.modules.length; i++){
    if(comp.component==this.modules[i].component){
       j+=1;
    }
  }
  if(j==1){
    return true;
  }else{
    return false;
  }
},

2.子组件中调用父组件的方法】

if(this.$main.isopened({
  component: "AddInputInformation", title: "新增存款信息"
})){
  this.$confirm("您已经打开新增页面");
}else{
  this.$confirm("进入存款新增页面");
}

猜你喜欢

转载自blog.csdn.net/weixin_43837268/article/details/84674960