java实习-vue表格弹窗功能

一. 准备步骤

1.在主组件页面 加入slot-scop标签
<template>
      <el-table
        <el-table-column prop="" show-overflow-tooltip label="">
1          <template slot-scope="scope">
            <el-link
              type="primary"
              :underline="false"
              @click="numberDetail(scope.row.id)"
            >
              {{scope.row.hasRank}}
            </el-link>
          </template>         
        </el-table-column>
      </el-table>
      <SystemNumberTable ref="SystemNumberTable"></SystemNumberTable>
</template>
2.写对应的方法调用子组件
<script>
import SystemNumberTable from "./SystemNumberTable";
export default {
  components: {
    //需要调用的子组件
    SystemNumberTable
  },
  methods:{
      numberDetail(id){
        //子组件的引用
       this.$refs.SystemNumberTable.refreshList(id);     
    },
  }

}
</script>

这里插入图片描述

3.在对应的组件写出你想要的弹窗表格
<template>
  <div>
    <el-dialog
      title=""
      :close-on-click-modal="false"
      v-dialogDrag
      :visible.sync="visible"
      @close="handleClose"
    >
      <el-table
        :data="dataList"
        size="medium"
        v-loading="loading"
        class="table"
      >
        <el-table-column show-overflow-tooltip label="">
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              @click="downloadEvt(scope.row.certInfo)"
              >附件
            </el-button>
          </template>
        </el-table-column>
        </el-table>
       </el-dialog>
  </div>
</template>
<script>
     data() {
     return {
      dataList: [],
    };
  },
    refreshList(id) {
      this.loading = true;
      this.visible = true;
      this.id=id;
      this.$http({
        url: ''
        method: "get",
      }).then(({ data }) => {
          let certInfo = data.levelProtectManager.certInfo
          let certRegistration = data.levelProtectManager.certRegistration
          let gradingReport = data.levelProtectManager.gradingReport
          let evalReport = data.levelProtectManager.evalReport
          this.dataList.push({
            certInfo,
            certRegistration,
            gradingReport,
            evalReport
          });
          this.loading = false;      
      });
    },
    handleClose(){
      this.dataList = []
    },
    //附件下载
    downloadEvt(url) {
      window.open(url, "_self");
    },    
    
}
}
</script>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值