美文网首页让前端飞Web前端之路
Element ui table展开行中,某些行需要展开,某些行

Element ui table展开行中,某些行需要展开,某些行

作者: 席小丽 | 来源:发表于2019-09-29 16:54 被阅读0次

1.templatetemplate里面对应的代码:

<el-table :data="menuList" style="width: 100%" :row-class-name="isShowIcon">
  <el-table-column type="expand">
    <template slot-scope="props" v-if="props.row.menuList">
      <el-table :data="props.row.menuList" :row-class-name="isShowIcon" :show-header=false>
        <el-table-column label="菜单名称" prop="menuName"></el-table-column>
        <el-table-column label="请求地址"  prop="url"></el-table-column>
        <el-table-column label="可见"  prop="isHide"></el-table-column>
      </el-table>
    </template>
  </el-table-column>
  <el-table-column label="菜单名称" prop="menuName"></el-table-column>
  <el-table-column label="请求地址"  prop="url"></el-table-column>
  <el-table-column label="可见"  prop="isHide"></el-table-column>
</el-table>

2.style里面对应的代码:

.hiderow .el-table__expand-column .el-icon {
  visibility: hidden;
}

3.script里面对应的代码:

methods:{
  isShowIcon(row, index){
  if(row.row.menuList != null)
    return ''
  else
    return 'hiderow' 
},

这个样子就可以了哦

image.png

相关文章

网友评论

    本文标题:Element ui table展开行中,某些行需要展开,某些行

    本文链接:https://www.haomeiwen.com/subject/punfpctx.html