vue $refs 的使用 传值

父传子
父亲:
点击登录打开完善信息页面

孩子: <wszjxx ref="wszjxx"></wszjxx>//完善信息页面
父亲: <el-button
          :loading="loading"
          size="medium"
          type="primary"
          style="width:100%;"
          @click.native.prevent="handleLogin"
        >
          <span v-if="!loading">登 录</span>
          <span v-else>登 录 中...</span>
        </el-button>

完善信息方法

   //获取当前登陆用户单位-专家信息 审批状态(0待审核,1未提交,2审核不通过,3审核通过)
    getLoginUserInfo(){
      getLoginUserInfo().then((response) => {
        //  this.loading = false;
         if(!response.data){
            var zgObj=JSON.stringify({userType:'-1'})
           sessionStorage.setItem('zgObj',zgObj)
             this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
         }
        else if(response.data.userType==3){
          sessionStorage.setItem('userType',response.data.userType)
          if(response.data.status==1||response.data.status==2){
             this.$refs.wszjxx.zjxx(response.data)//把response.data传给孩子的页面
          }else if(response.data.status==3){
              this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
          } else if(response.data.status==0){
             this.$store.dispatch('LogOut').then(() => {
               sessionStorage.clear();
             })
            this.$alert("主管审核中!", "提示", {
              confirmButtonText: "确定",
            });
             this.loading = false;
          }
        }else if(response.data.userType==2){
           sessionStorage.setItem('userType',response.data.userType)
           if(response.data.status==1||response.data.status==2){
            this.$refs.wsqyxx.openDia(response.data)
          }else if(response.data.status==3){
              this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
          }
          else if(response.data.status==0){
             this.$store.dispatch('LogOut').then(() => {
               sessionStorage.clear();
             })
            this.$alert("主管审核中!", "提示", {
              confirmButtonText: "确定",
            });
             this.loading = false;
          }
        }else if(response.data.userType==0){
           var zgObj=JSON.stringify(response.data)
           sessionStorage.setItem('zgObj',zgObj)
            this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
        }
        
      }).catch((response) => {
         this.$store.dispatch('LogOut').then(() => {
           sessionStorage.clear();
          location.href = '/index';
        })
          this.$message.error(response.msg);
      });
    },

孩子接收父亲页面的方法zjxx

   zjxx(val){
     this.wszjxxopen = true
     this.getArea()
     this.form = val//(父亲传过来的res.response)
     this.flag=val.status
     this.form.id = val.id
     this.title="完善专家信息"
    },
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值